/libuv/docs/code/multi-echo-server/ |
H A D | worker.c | 34 void echo_read(uv_stream_t *client, ssize_t nread, const uv_buf_t *buf) { in echo_read() argument 35 if (nread > 0) { in echo_read() 37 req->buf = uv_buf_init(buf->base, nread); in echo_read() 42 if (nread < 0) { in echo_read() 43 if (nread != UV_EOF) in echo_read() 44 fprintf(stderr, "Read error %s\n", uv_err_name(nread)); in echo_read() 51 void on_new_connection(uv_stream_t *q, ssize_t nread, const uv_buf_t *buf) { in on_new_connection() argument 52 if (nread < 0) { in on_new_connection() 53 if (nread != UV_EOF) in on_new_connection() 54 fprintf(stderr, "Read error %s\n", uv_err_name(nread)); in on_new_connection()
|
/libuv/test/ |
H A D | test-ipc.c | 153 if (nread == 0) { in on_read() 159 if (nread < 0) { in on_read() 222 if (nread == 0) { in on_read_listen_after_bound_twice() 228 if (nread < 0) { in on_read_listen_after_bound_twice() 242 ASSERT_GT(nread, 0); in on_read_listen_after_bound_twice() 338 ASSERT_GT(nread, 0); in on_tcp_read() 359 if (nread == 0) { in on_read_connection() 365 if (nread < 0) { in on_read_connection() 380 ASSERT_GT(nread, 0); in on_read_connection() 412 ASSERT(nread == 0 || nread == UV_EOF); in on_read_send_zero() [all …]
|
H A D | test-udp-send-and-recv.c | 63 ssize_t nread, in cl_recv_cb() argument 70 if (nread < 0) { in cl_recv_cb() 74 if (nread == 0) { in cl_recv_cb() 81 ASSERT_EQ(4, nread); in cl_recv_cb() 82 ASSERT(!memcmp("PONG", buf->base, nread)); in cl_recv_cb() 117 ssize_t nread, in sv_recv_cb() argument 125 if (nread < 0) { in sv_recv_cb() 129 if (nread == 0) { in sv_recv_cb() 139 ASSERT_EQ(4, nread); in sv_recv_cb() 140 ASSERT(!memcmp("PING", rcvbuf->base, nread)); in sv_recv_cb()
|
H A D | test-udp-ipv6.c | 110 ssize_t nread, in ipv6_recv_fail() argument 114 printf("got %d %.*s\n", (int) nread, nread > 0 ? (int) nread : 0, buf->base); in ipv6_recv_fail() 115 if (!is_from_client(addr) || (nread == 0 && addr == NULL)) in ipv6_recv_fail() 122 ssize_t nread, in ipv6_recv_ok() argument 128 printf("got %d %.*s\n", (int) nread, nread > 0 ? (int) nread : 0, buf->base); in ipv6_recv_ok() 129 if (!is_from_client(addr) || (nread == 0 && addr == NULL)) in ipv6_recv_ok() 132 ASSERT_EQ(9, nread); in ipv6_recv_ok()
|
H A D | echo-server.c | 81 ssize_t nread, in after_read() argument 88 if (nread < 0) { in after_read() 90 ASSERT_EQ(nread, UV_EOF); in after_read() 100 if (nread == 0) { in after_read() 112 for (i = 0; i < nread; i++) { in after_read() 114 if (i + 1 < nread && buf->base[i + 1] == 'S') { in after_read() 137 wr->buf = uv_buf_init(buf->base, nread); in after_read() 230 ssize_t nread, in on_recv() argument 237 if (nread == 0) { in on_recv() 242 ASSERT_GT(nread, 0); in on_recv() [all …]
|
H A D | test-iouring-pollhup.c | 50 ssize_t nread, in read_data2() argument 52 if (nread < 0) { in read_data2() 53 ASSERT_EQ(nread, UV_EOF); in read_data2() 63 ASSERT_GT(nread, 0); in read_data2() 79 ssize_t nread, in read_data() argument 81 ASSERT_EQ(nread, UV_EOF); in read_data()
|
H A D | test-udp-send-immediate.c | 68 ssize_t nread, in sv_recv_cb() argument 72 if (nread < 0) { in sv_recv_cb() 76 if (nread == 0) { in sv_recv_cb() 86 ASSERT_EQ(4, nread); in sv_recv_cb() 87 ASSERT(memcmp("PING", rcvbuf->base, nread) == 0 || in sv_recv_cb() 88 memcmp("PANG", rcvbuf->base, nread) == 0); in sv_recv_cb()
|
H A D | test-udp-alloc-cb-fail.c | 69 ssize_t nread, in cl_recv_cb() argument 75 ASSERT_EQ(nread, UV_ENOBUFS); in cl_recv_cb() 110 ssize_t nread, in sv_recv_cb() argument 118 if (nread < 0) { in sv_recv_cb() 122 if (nread == 0) { in sv_recv_cb() 132 ASSERT_EQ(4, nread); in sv_recv_cb() 133 ASSERT(!memcmp("PING", rcvbuf->base, nread)); in sv_recv_cb()
|
H A D | test-udp-mmsg.c | 72 ssize_t nread, in recv_cb() argument 76 ASSERT_GE(nread, 0); in recv_cb() 80 ASSERT_OK(nread); in recv_cb() 86 if (nread == 0) { in recv_cb() 90 ASSERT_EQ(4, nread); in recv_cb() 92 ASSERT_MEM_EQ("PING", rcvbuf->base, nread); in recv_cb()
|
H A D | test-tcp-write-to-half-open-connection.c | 32 static void read_cb(uv_stream_t* stream, ssize_t nread, const uv_buf_t* buf); 77 static void read_cb(uv_stream_t* stream, ssize_t nread, const uv_buf_t* buf) { in read_cb() argument 78 if (nread < 0) { in read_cb() 79 fprintf(stderr, "read_cb error: %s\n", uv_err_name(nread)); in read_cb() 80 ASSERT(nread == UV_ECONNRESET || nread == UV_EOF); in read_cb()
|
H A D | test-callback-stack.c | 70 static void read_cb(uv_stream_t* tcp, ssize_t nread, const uv_buf_t* buf) { in read_cb() argument 73 printf("Read. nread == %d\n", (int)nread); in read_cb() 76 if (nread == 0) { in read_cb() 79 } else if (nread < 0) { in read_cb() 80 ASSERT_EQ(nread, UV_EOF); in read_cb() 89 bytes_received += nread; in read_cb()
|
H A D | test-udp-try-send.c | 59 ssize_t nread, in sv_recv_cb() argument 63 ASSERT_GT(nread, 0); in sv_recv_cb() 65 if (nread == 0) { in sv_recv_cb() 70 ASSERT_EQ(4, nread); in sv_recv_cb() 73 ASSERT_OK(memcmp("EXIT", rcvbuf->base, nread)); in sv_recv_cb()
|
H A D | benchmark-spawn.c | 91 static void on_read(uv_stream_t* pipe, ssize_t nread, const uv_buf_t* buf) { in on_read() argument 92 if (nread > 0) { in on_read() 94 output_used += nread; in on_read() 95 } else if (nread < 0) { in on_read() 96 if (nread == UV_EOF) { in on_read()
|
H A D | test-tcp-read-stop-start.c | 33 static void on_read2(uv_stream_t* stream, ssize_t nread, const uv_buf_t* buf); 64 static void on_read1(uv_stream_t* stream, ssize_t nread, const uv_buf_t* buf) { in on_read1() argument 65 ASSERT_GE(nread, 0); in on_read1() 79 static void on_read2(uv_stream_t* stream, ssize_t nread, const uv_buf_t* buf) { in on_read2() argument 80 ASSERT_LT(nread, 0); in on_read2()
|
H A D | test-stdio-over-pipes.c | 97 static void on_read(uv_stream_t* pipe, ssize_t nread, const uv_buf_t* rdbuf) { in on_read() argument 102 ASSERT(nread > 0 || nread == UV_EOF); in on_read() 104 if (nread > 0) { in on_read() 105 output_used += nread; in on_read() 181 static void on_pipe_read(uv_stream_t* pipe, ssize_t nread, const uv_buf_t* buf) { in on_pipe_read() argument 182 ASSERT_GT(nread, 0); in on_pipe_read() 183 ASSERT_OK(memcmp("hello world\n", buf->base, nread)); in on_pipe_read()
|
H A D | test-tcp-open.c | 113 static void read_cb(uv_stream_t* tcp, ssize_t nread, const uv_buf_t* buf) { in read_cb() argument 116 if (nread >= 0) { in read_cb() 117 ASSERT_EQ(4, nread); in read_cb() 118 ASSERT_OK(memcmp("PING", buf->base, nread)); in read_cb() 121 ASSERT_EQ(nread, UV_EOF); in read_cb() 127 static void read1_cb(uv_stream_t* tcp, ssize_t nread, const uv_buf_t* buf) { in read1_cb() argument 131 if (nread >= 0) { in read1_cb() 132 for (i = 0; i < nread; ++i) in read1_cb() 135 ASSERT_EQ(nread, UV_EOF); in read1_cb()
|
H A D | test-udp-multicast-join.c | 92 ssize_t nread, in cl_recv_cb() argument 99 if (nread < 0) { in cl_recv_cb() 103 if (nread == 0) { in cl_recv_cb() 110 ASSERT_EQ(4, nread); in cl_recv_cb() 111 ASSERT(!memcmp("PING", buf->base, nread)); in cl_recv_cb()
|
H A D | test-tcp-close-after-read-timeout.c | 40 ssize_t nread, 67 static void on_client_read(uv_stream_t* stream, ssize_t nread, in on_client_read() argument 69 ASSERT_LT(nread, 0); in on_client_read() 93 ssize_t nread, in on_connection_read() argument 95 ASSERT_EQ(nread, UV_EOF); in on_connection_read()
|
H A D | test-shutdown-simultaneous.c | 52 static void read_cb(uv_stream_t* t, ssize_t nread, const uv_buf_t* buf) { in read_cb() argument 55 if (nread == 0) { in read_cb() 61 ASSERT_EQ(4, nread); in read_cb() 71 ASSERT_EQ(nread, UV_EOF); in read_cb()
|
H A D | blackhole-server.c | 37 static void read_cb(uv_stream_t* stream, ssize_t nread, const uv_buf_t* buf); 72 static void read_cb(uv_stream_t* stream, ssize_t nread, const uv_buf_t* buf) { in read_cb() argument 76 if (nread >= 0) in read_cb() 79 ASSERT_EQ(nread, UV_EOF); in read_cb()
|
H A D | test-ping-pong.c | 122 ssize_t nread, in pinger_read_cb() argument 129 if (nread < 0) { in pinger_read_cb() 130 ASSERT_EQ(nread, UV_EOF); in pinger_read_cb() 141 for (i = 0; i < nread; i++) { in pinger_read_cb() 164 ssize_t nread, in ponger_read_cb() argument 170 if (nread < 0) { in ponger_read_cb() 171 ASSERT_EQ(nread, UV_EOF); in ponger_read_cb() 182 for (i = 0; i < nread; i++) { in ponger_read_cb() 187 writebuf = uv_buf_init(buf->base, nread); in ponger_read_cb()
|
/libuv/docs/code/dns/ |
H A D | main.c | 13 void on_read(uv_stream_t *client, ssize_t nread, const uv_buf_t *buf) { in on_read() argument 14 if (nread < 0) { in on_read() 15 if (nread != UV_EOF) in on_read() 16 fprintf(stderr, "Read error %s\n", uv_err_name(nread)); in on_read() 23 char *data = (char*) malloc(sizeof(char) * (nread+1)); in on_read() 24 data[nread] = '\0'; in on_read() 25 strncpy(data, buf->base, nread); in on_read()
|
/libuv/docs/code/pipe-echo-server/ |
H A D | main.c | 37 void echo_read(uv_stream_t *client, ssize_t nread, const uv_buf_t *buf) { in echo_read() argument 38 if (nread > 0) { in echo_read() 40 req->buf = uv_buf_init(buf->base, nread); in echo_read() 45 if (nread < 0) { in echo_read() 46 if (nread != UV_EOF) in echo_read() 47 fprintf(stderr, "Read error %s\n", uv_err_name(nread)); in echo_read()
|
/libuv/docs/code/tcp-echo-server/ |
H A D | main.c | 39 void echo_read(uv_stream_t *client, ssize_t nread, const uv_buf_t *buf) { in echo_read() argument 40 if (nread > 0) { in echo_read() 42 req->buf = uv_buf_init(buf->base, nread); in echo_read() 46 if (nread < 0) { in echo_read() 47 if (nread != UV_EOF) in echo_read() 48 fprintf(stderr, "Read error %s\n", uv_err_name(nread)); in echo_read()
|
/libuv/docs/code/uvtee/ |
H A D | main.c | 43 void read_stdin(uv_stream_t *stream, ssize_t nread, const uv_buf_t *buf) { in read_stdin() argument 44 if (nread < 0){ in read_stdin() 45 if (nread == UV_EOF){ in read_stdin() 51 } else if (nread > 0) { in read_stdin() 52 write_data((uv_stream_t *)&stdout_pipe, nread, *buf, on_stdout_write); in read_stdin() 53 write_data((uv_stream_t *)&file_pipe, nread, *buf, on_file_write); in read_stdin()
|