Lines Matching refs:pinger

70   pinger_t* pinger = (pinger_t*) handle->data;  in pinger_on_close()  local
72 ASSERT_EQ(NUM_PINGS, pinger->pongs); in pinger_on_close()
74 if (handle == (uv_handle_t*) &pinger->stream.tcp) { in pinger_on_close()
75 free(pinger); /* also frees handle */ in pinger_on_close()
77 uv_close((uv_handle_t*) &pinger->stream.tcp, ponger_on_close); in pinger_on_close()
92 static void pinger_write_ping(pinger_t* pinger) { in pinger_write_ping() argument
98 stream = (uv_stream_t*) &pinger->stream.tcp; in pinger_write_ping()
100 if (!pinger->vectored_writes) { in pinger_write_ping()
125 pinger_t* pinger; in pinger_read_cb() local
127 pinger = (pinger_t*) stream->data; in pinger_read_cb()
142 ASSERT_EQ(buf->base[i], pinger->pong[pinger->state]); in pinger_read_cb()
143 pinger->state = (pinger->state + 1) % strlen(pinger->pong); in pinger_read_cb()
145 if (pinger->state != 0) in pinger_read_cb()
148 printf("PONG %d\n", pinger->pongs); in pinger_read_cb()
149 pinger->pongs++; in pinger_read_cb()
151 if (pinger->pongs < NUM_PINGS) { in pinger_read_cb()
152 pinger_write_ping(pinger); in pinger_read_cb()
196 pinger_t* pinger = (pinger_t*) req->handle->data; in pinger_on_connect() local
206 pinger_write_ping(pinger); in pinger_on_connect()
218 pinger_t* pinger; in tcp_pinger_v6_new() local
222 pinger = malloc(sizeof(*pinger)); in tcp_pinger_v6_new()
223 ASSERT_NOT_NULL(pinger); in tcp_pinger_v6_new()
224 pinger->vectored_writes = vectored_writes; in tcp_pinger_v6_new()
225 pinger->state = 0; in tcp_pinger_v6_new()
226 pinger->pongs = 0; in tcp_pinger_v6_new()
227 pinger->pong = PING; in tcp_pinger_v6_new()
230 r = uv_tcp_init(uv_default_loop(), &pinger->stream.tcp); in tcp_pinger_v6_new()
231 pinger->stream.tcp.data = pinger; in tcp_pinger_v6_new()
236 r = uv_tcp_connect(&pinger->connect_req, in tcp_pinger_v6_new()
237 &pinger->stream.tcp, in tcp_pinger_v6_new()
250 pinger_t* pinger; in tcp_pinger_new() local
253 pinger = malloc(sizeof(*pinger)); in tcp_pinger_new()
254 ASSERT_NOT_NULL(pinger); in tcp_pinger_new()
255 pinger->vectored_writes = vectored_writes; in tcp_pinger_new()
256 pinger->state = 0; in tcp_pinger_new()
257 pinger->pongs = 0; in tcp_pinger_new()
258 pinger->pong = PING; in tcp_pinger_new()
261 r = uv_tcp_init(uv_default_loop(), &pinger->stream.tcp); in tcp_pinger_new()
262 pinger->stream.tcp.data = pinger; in tcp_pinger_new()
267 r = uv_tcp_connect(&pinger->connect_req, in tcp_pinger_new()
268 &pinger->stream.tcp, in tcp_pinger_new()
280 pinger_t* pinger; in pipe_pinger_new() local
282 pinger = malloc(sizeof(*pinger)); in pipe_pinger_new()
283 ASSERT_NOT_NULL(pinger); in pipe_pinger_new()
284 pinger->vectored_writes = vectored_writes; in pipe_pinger_new()
285 pinger->state = 0; in pipe_pinger_new()
286 pinger->pongs = 0; in pipe_pinger_new()
287 pinger->pong = PING; in pipe_pinger_new()
290 r = uv_pipe_init(uv_default_loop(), &pinger->stream.pipe, 0); in pipe_pinger_new()
291 pinger->stream.pipe.data = pinger; in pipe_pinger_new()
296 uv_pipe_connect(&pinger->connect_req, &pinger->stream.pipe, TEST_PIPENAME, in pipe_pinger_new()
305 pinger_t* pinger; in socketpair_pinger_new() local
309 pinger = malloc(sizeof(*pinger)); in socketpair_pinger_new()
310 ASSERT_NOT_NULL(pinger); in socketpair_pinger_new()
311 pinger->vectored_writes = vectored_writes; in socketpair_pinger_new()
312 pinger->state = 0; in socketpair_pinger_new()
313 pinger->pongs = 0; in socketpair_pinger_new()
314 pinger->pong = PONG; in socketpair_pinger_new()
325 ASSERT_OK(uv_tcp_init(uv_default_loop(), &pinger->stream.tcp)); in socketpair_pinger_new()
326 pinger->stream.pipe.data = pinger; in socketpair_pinger_new()
327 ASSERT_OK(uv_tcp_open(&pinger->stream.tcp, fds[1])); in socketpair_pinger_new()
335 pinger_write_ping(pinger); in socketpair_pinger_new()
337 ASSERT_OK(uv_read_start((uv_stream_t*) &pinger->stream.tcp, in socketpair_pinger_new()
348 pinger_t* pinger; in pipe2_pinger_new() local
361 pinger = malloc(sizeof(*pinger)); in pipe2_pinger_new()
362 ASSERT_NOT_NULL(pinger); in pipe2_pinger_new()
363 pinger->vectored_writes = vectored_writes; in pipe2_pinger_new()
364 pinger->state = 0; in pipe2_pinger_new()
365 pinger->pongs = 0; in pipe2_pinger_new()
366 pinger->pong = PING; in pipe2_pinger_new()
367 ASSERT_OK(uv_pipe_init(uv_default_loop(), &pinger->stream.pipe, 0)); in pipe2_pinger_new()
368 ASSERT_OK(uv_pipe_open(&pinger->stream.pipe, fds[1])); in pipe2_pinger_new()
369 pinger->stream.pipe.data = pinger; /* record for close_cb */ in pipe2_pinger_new()
370 ponger->data = pinger; /* record for read_cb */ in pipe2_pinger_new()
372 pinger_write_ping(pinger); in pipe2_pinger_new()