test-ipc.c
Go to the documentation of this file.
1 /* Copyright Joyent, Inc. and other Node contributors. All rights reserved.
2  *
3  * Permission is hereby granted, free of charge, to any person obtaining a copy
4  * of this software and associated documentation files (the "Software"), to
5  * deal in the Software without restriction, including without limitation the
6  * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
7  * sell copies of the Software, and to permit persons to whom the Software is
8  * furnished to do so, subject to the following conditions:
9  *
10  * The above copyright notice and this permission notice shall be included in
11  * all copies or substantial portions of the Software.
12  *
13  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
18  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
19  * IN THE SOFTWARE.
20  */
21 
22 #include "uv.h"
23 #include "task.h"
24 
25 #include <stdio.h>
26 #include <string.h>
27 
32 
33 static int exit_cb_called;
34 static int read_cb_called;
36 static int tcp_read_cb_called;
44 static int close_cb_called;
50 static int send_zero_write;
51 
52 typedef struct {
56 } tcp_conn;
57 
58 #define CONN_COUNT 100
59 #define BACKLOG 128
60 #define LARGE_SIZE 100000
61 
63 static char buffer[LARGE_SIZE];
64 static uv_write_t write_reqs[300];
66 
67 static unsigned int write_until_data_queued(void);
68 static void send_handle_and_close(void);
69 
70 
72  free(handle);
73 }
74 
75 
76 static void on_connection(uv_stream_t* server, int status) {
77  uv_tcp_t* conn;
78  int r;
79 
80  if (!local_conn_accepted) {
81  /* Accept the connection and close it. Also and close the server. */
82  ASSERT_EQ(status, 0);
84 
85  conn = malloc(sizeof(*conn));
87  r = uv_tcp_init(server->loop, conn);
88  ASSERT_EQ(r, 0);
89 
91  ASSERT_EQ(r, 0);
92 
94  uv_close((uv_handle_t*)server, NULL);
96  }
97 }
98 
99 
101  int64_t exit_status,
102  int term_signal) {
103  printf("exit_cb\n");
104  exit_cb_called++;
105  ASSERT_EQ(exit_status, 0);
106  ASSERT_EQ(term_signal, 0);
107  uv_close((uv_handle_t*)process, NULL);
108 }
109 
110 
112  size_t suggested_size,
113  uv_buf_t* buf) {
114  buf->base = malloc(suggested_size);
115  buf->len = suggested_size;
116 }
117 
118 
120  tcp_conn* p = (tcp_conn*)handle->data;
121  free(p);
122 }
123 
124 
125 static void connect_cb(uv_connect_t* req, int status) {
127 }
128 
129 
130 static void make_many_connections(void) {
131  tcp_conn* conn;
132  struct sockaddr_in addr;
133  int r, i;
134 
135  for (i = 0; i < CONN_COUNT; i++) {
136  conn = malloc(sizeof(*conn));
138 
140  ASSERT_EQ(r, 0);
141  ASSERT_EQ(0, uv_ip4_addr("127.0.0.1", TEST_PORT, &addr));
142 
144  (uv_tcp_t*) &conn->conn,
145  (const struct sockaddr*) &addr,
146  connect_cb);
147  ASSERT_EQ(r, 0);
148 
149  conn->conn.data = conn;
150  }
151 }
152 
153 
155  ssize_t nread,
156  const uv_buf_t* buf) {
157  int r;
158  uv_pipe_t* pipe;
161 
162  pipe = (uv_pipe_t*) handle;
163 
164  if (nread == 0) {
165  /* Everything OK, but nothing read. */
166  free(buf->base);
167  return;
168  }
169 
170  if (nread < 0) {
171  if (nread == UV_EOF) {
172  free(buf->base);
173  return;
174  }
175 
176  printf("error recving on channel: %s\n", uv_strerror(nread));
177  abort();
178  }
179 
180  fprintf(stderr, "got %d bytes\n", (int)nread);
181 
183  if (!tcp_server_listening) {
185  ASSERT_GT(nread, 0);
186  ASSERT_NOT_NULL(buf->base);
188  read_cb_called++;
189 
190  /* Accept the pending TCP server, and start listening on it. */
191  ASSERT_EQ(pending, UV_TCP);
193  ASSERT_EQ(r, 0);
194 
196  ASSERT_EQ(r, 0);
197 
199  ASSERT_EQ(r, 0);
200 
202 
203  /* Make sure that the expected data is correctly multiplexed. */
204  ASSERT_MEM_EQ("hello\n", buf->base, nread);
205 
206  outbuf = uv_buf_init("world\n", 6);
207  r = uv_write(&write_req, (uv_stream_t*)pipe, &outbuf, 1, NULL);
208  ASSERT_EQ(r, 0);
209 
210  /* Create a bunch of connections to get both servers to accept. */
212  } else if (memcmp("accepted_connection\n", buf->base, nread) == 0) {
213  /* Remote server has accepted a connection. Close the channel. */
217  uv_close((uv_handle_t*)&channel, NULL);
218  }
219 
220  free(buf->base);
221 }
222 
223 #ifdef _WIN32
224 static void on_read_listen_after_bound_twice(uv_stream_t* handle,
225  ssize_t nread,
226  const uv_buf_t* buf) {
227  int r;
228  uv_pipe_t* pipe;
230 
231  pipe = (uv_pipe_t*) handle;
232 
233  if (nread == 0) {
234  /* Everything OK, but nothing read. */
235  free(buf->base);
236  return;
237  }
238 
239  if (nread < 0) {
240  if (nread == UV_EOF) {
241  free(buf->base);
242  return;
243  }
244 
245  printf("error recving on channel: %s\n", uv_strerror(nread));
246  abort();
247  }
248 
249  fprintf(stderr, "got %d bytes\n", (int)nread);
250 
253  ASSERT_GT(nread, 0);
254  ASSERT_NOT_NULL(buf->base);
256  read_cb_called++;
257 
258  if (read_cb_called == 1) {
259  /* Accept the first TCP server, and start listening on it. */
260  ASSERT_EQ(pending, UV_TCP);
262  ASSERT_EQ(r, 0);
263 
265  ASSERT_EQ(r, 0);
266 
268  ASSERT_EQ(r, 0);
269  } else if (read_cb_called == 2) {
270  /* Accept the second TCP server, and start listening on it. */
271  ASSERT_EQ(pending, UV_TCP);
273  ASSERT_EQ(r, 0);
274 
276  ASSERT_EQ(r, 0);
277 
279  ASSERT_EQ(r, UV_EADDRINUSE);
280 
281  uv_close((uv_handle_t*)&tcp_server, NULL);
282  uv_close((uv_handle_t*)&tcp_server2, NULL);
284  uv_close((uv_handle_t*)&channel, NULL);
285  }
286 
287  free(buf->base);
288 }
289 #endif
290 
293  const char* helper) {
295  size_t exepath_size;
296  char exepath[1024];
297  char* args[3];
298  int r;
299  uv_stdio_container_t stdio[3];
300 
302  ASSERT_EQ(r, 0);
303  ASSERT_NE(channel->ipc, 0);
304 
305  exepath_size = sizeof(exepath);
307  ASSERT_EQ(r, 0);
308 
309  exepath[exepath_size] = '\0';
310  args[0] = exepath;
311  args[1] = (char*)helper;
312  args[2] = NULL;
313 
314  memset(&options, 0, sizeof(options));
315  options.file = exepath;
316  options.args = args;
317  options.exit_cb = exit_cb;
318  options.stdio = stdio;
319  options.stdio_count = ARRAY_SIZE(stdio);
320 
322  stdio[0].data.stream = (uv_stream_t*) channel;
323  stdio[1].flags = UV_INHERIT_FD;
324  stdio[1].data.fd = 1;
325  stdio[2].flags = UV_INHERIT_FD;
326  stdio[2].data.fd = 2;
327 
329  ASSERT_EQ(r, 0);
330 }
331 
332 
333 static void on_tcp_write(uv_write_t* req, int status) {
334  ASSERT_EQ(status, 0);
337 }
338 
339 
341  size_t suggested_size,
342  uv_buf_t* buf) {
343  buf->base = malloc(suggested_size);
344  buf->len = suggested_size;
345 }
346 
347 
348 static void on_tcp_read(uv_stream_t* tcp, ssize_t nread, const uv_buf_t* buf) {
349  ASSERT_GT(nread, 0);
350  ASSERT_MEM_EQ("hello again\n", buf->base, nread);
352  free(buf->base);
353 
355 
356  uv_close((uv_handle_t*)tcp, NULL);
357  uv_close((uv_handle_t*)&channel, NULL);
358 }
359 
360 
362  ssize_t nread,
363  const uv_buf_t* buf) {
364  int r;
366  uv_pipe_t* pipe;
368 
369  pipe = (uv_pipe_t*) handle;
370  if (nread == 0) {
371  /* Everything OK, but nothing read. */
372  free(buf->base);
373  return;
374  }
375 
376  if (nread < 0) {
377  if (nread == UV_EOF) {
378  free(buf->base);
379  return;
380  }
381 
382  printf("error recving on channel: %s\n", uv_strerror(nread));
383  abort();
384  }
385 
386  fprintf(stderr, "got %d bytes\n", (int)nread);
387 
390 
391  ASSERT_GT(nread, 0);
392  ASSERT_NOT_NULL(buf->base);
394  read_cb_called++;
395 
396  /* Accept the pending TCP connection */
397  ASSERT_EQ(pending, UV_TCP);
399  ASSERT_EQ(r, 0);
400 
402  ASSERT_EQ(r, 0);
403 
404  /* Make sure that the expected data is correctly multiplexed. */
405  ASSERT_MEM_EQ("hello\n", buf->base, nread);
406 
407  /* Write/read to/from the connection */
408  outbuf = uv_buf_init("world\n", 6);
410  on_tcp_write);
411  ASSERT_EQ(r, 0);
412 
414  ASSERT_EQ(r, 0);
415 
416  free(buf->base);
417 }
418 
419 
420 #ifndef _WIN32
422  ssize_t nread,
423  const uv_buf_t* buf) {
424  if (nread == 0 || nread == UV_EOF) {
425  free(buf->base);
426  return;
427  }
428 
429  if (nread < 0) {
430  printf("error recving on channel: %s\n", uv_strerror(nread));
431  abort();
432  }
433 
434  closed_handle_data_read += nread;
435  free(buf->base);
436 }
437 #endif
438 
439 
441  ssize_t nread,
442  const uv_buf_t* buf) {
443  ASSERT(nread == 0 || nread == UV_EOF);
444  free(buf->base);
445 }
446 
447 
448 static int run_ipc_test(const char* helper, uv_read_cb read_cb) {
450  int r;
451 
452  spawn_helper(&channel, &process, helper);
454 
456  ASSERT_EQ(r, 0);
457 
459  return 0;
460 }
461 
462 
463 TEST_IMPL(ipc_listen_before_write) {
464 #if defined(NO_SEND_HANDLE_ON_PIPE)
465  RETURN_SKIP(NO_SEND_HANDLE_ON_PIPE);
466 #endif
467  int r = run_ipc_test("ipc_helper_listen_before_write", on_read);
472  return r;
473 }
474 
475 
476 TEST_IMPL(ipc_listen_after_write) {
477 #if defined(NO_SEND_HANDLE_ON_PIPE)
478  RETURN_SKIP(NO_SEND_HANDLE_ON_PIPE);
479 #endif
480  int r = run_ipc_test("ipc_helper_listen_after_write", on_read);
485  return r;
486 }
487 
488 
489 TEST_IMPL(ipc_tcp_connection) {
490 #if defined(NO_SEND_HANDLE_ON_PIPE)
491  RETURN_SKIP(NO_SEND_HANDLE_ON_PIPE);
492 #endif
493  int r = run_ipc_test("ipc_helper_tcp_connection", on_read_connection);
498  return r;
499 }
500 
501 #ifndef _WIN32
502 TEST_IMPL(ipc_closed_handle) {
503  int r;
504  r = run_ipc_test("ipc_helper_closed_handle", on_read_closed_handle);
505  ASSERT_EQ(r, 0);
506  return 0;
507 }
508 #endif
509 
510 
511 #ifdef _WIN32
512 TEST_IMPL(listen_with_simultaneous_accepts) {
514  int r;
515  struct sockaddr_in addr;
516 
517  ASSERT_EQ(0, uv_ip4_addr("0.0.0.0", TEST_PORT, &addr));
518 
520  ASSERT_EQ(r, 0);
521 
522  r = uv_tcp_bind(&server, (const struct sockaddr*) &addr, 0);
523  ASSERT_EQ(r, 0);
524 
526  ASSERT_EQ(r, 0);
527 
528  r = uv_listen((uv_stream_t*)&server, SOMAXCONN, NULL);
529  ASSERT_EQ(r, 0);
530  ASSERT_EQ(server.reqs_pending, 32);
531 
533  return 0;
534 }
535 
536 
537 TEST_IMPL(listen_no_simultaneous_accepts) {
539  int r;
540  struct sockaddr_in addr;
541 
542  ASSERT_EQ(0, uv_ip4_addr("0.0.0.0", TEST_PORT, &addr));
543 
545  ASSERT_EQ(r, 0);
546 
547  r = uv_tcp_bind(&server, (const struct sockaddr*) &addr, 0);
548  ASSERT_EQ(r, 0);
549 
551  ASSERT_EQ(r, 0);
552 
553  r = uv_listen((uv_stream_t*)&server, SOMAXCONN, NULL);
554  ASSERT_EQ(r, 0);
555  ASSERT_EQ(server.reqs_pending, 1);
556 
558  return 0;
559 }
560 
561 TEST_IMPL(ipc_listen_after_bind_twice) {
562 #if defined(NO_SEND_HANDLE_ON_PIPE)
563  RETURN_SKIP(NO_SEND_HANDLE_ON_PIPE);
564 #endif
565  int r = run_ipc_test("ipc_helper_bind_twice", on_read_listen_after_bound_twice);
568  return r;
569 }
570 #endif
571 
572 TEST_IMPL(ipc_send_zero) {
573  int r;
574  r = run_ipc_test("ipc_helper_send_zero", on_read_send_zero);
575  ASSERT_EQ(r, 0);
576  return 0;
577 }
578 
579 
580 /* Everything here runs in a child process. */
581 
582 static tcp_conn conn;
583 
584 
585 static void close_cb(uv_handle_t* handle) {
586  close_cb_called++;
587 }
588 
589 
593 }
594 
595 
602 }
603 
604 
606  ASSERT_EQ(status, 0);
610  if (write_until_data_queued() > 0)
612  }
613 }
614 
615 
617  ASSERT_EQ(status, UV_EBADF);
619 }
620 
621 
623  ASSERT_EQ(status, 0);
624  send_zero_write++;
625 }
626 
628  ssize_t nread,
629  const uv_buf_t* buf) {
631  int r;
632 
633  if (nread < 0) {
634  if (nread == UV_EOF) {
635  free(buf->base);
636  return;
637  }
638 
639  printf("error recving on tcp connection: %s\n", uv_strerror(nread));
640  abort();
641  }
642 
643  ASSERT_GT(nread, 0);
644  ASSERT_MEM_EQ("world\n", buf->base, nread);
646  free(buf->base);
647 
648  /* Write to the socket */
649  outbuf = uv_buf_init("hello again\n", 12);
651  ASSERT_EQ(r, 0);
652 
654 }
655 
656 
658  int r;
659 
660  ASSERT_EQ(status, 0);
662  ASSERT_EQ(r, 0);
663 }
664 
665 
667  int r;
668  uv_buf_t buf;
669 
670  if (!connection_accepted) {
671  /*
672  * Accept the connection and close it. Also let the other
673  * side know.
674  */
675  ASSERT_EQ(status, 0);
677 
678  r = uv_tcp_init(server->loop, &conn.conn);
679  ASSERT_EQ(r, 0);
680 
682  ASSERT_EQ(r, 0);
683 
685 
686  buf = uv_buf_init("accepted_connection\n", 20);
688  NULL, conn_notify_write_cb);
689  ASSERT_EQ(r, 0);
690 
692  }
693 }
694 
695 
697  int r;
698  uv_buf_t buf;
699  uv_tcp_t* conn;
700 
701  ASSERT_EQ(status, 0);
703 
704  conn = malloc(sizeof(*conn));
706 
707  r = uv_tcp_init(server->loop, conn);
708  ASSERT_EQ(r, 0);
709 
711  ASSERT_EQ(r, 0);
712 
713  /* Send the accepted connection to the other process */
714  buf = uv_buf_init("hello\n", 6);
716  (uv_stream_t*)conn, NULL);
717  ASSERT_EQ(r, 0);
718 
722  ASSERT_EQ(r, 0);
723 
725 }
726 
727 
728 int ipc_helper(int listen_after_write) {
729  /*
730  * This is launched from test-ipc.c. stdin is a duplex channel that we
731  * over which a handle will be transmitted.
732  */
733  struct sockaddr_in addr;
734  int r;
735  uv_buf_t buf;
736 
737  ASSERT_EQ(0, uv_ip4_addr("0.0.0.0", TEST_PORT, &addr));
738 
740  ASSERT_EQ(r, 0);
741 
742  uv_pipe_open(&channel, 0);
743 
747 
749  ASSERT_EQ(r, 0);
750 
751  r = uv_tcp_bind(&tcp_server, (const struct sockaddr*) &addr, 0);
752  ASSERT_EQ(r, 0);
753 
754  if (!listen_after_write) {
756  ASSERT_EQ(r, 0);
757  }
758 
759  buf = uv_buf_init("hello\n", 6);
761  (uv_stream_t*)&tcp_server, NULL);
762  ASSERT_EQ(r, 0);
763 
764  if (listen_after_write) {
766  ASSERT_EQ(r, 0);
767  }
768 
771  ASSERT_EQ(r, 0);
772 
775 
777  return 0;
778 }
779 
780 
782  /*
783  * This is launched from test-ipc.c. stdin is a duplex channel
784  * over which a handle will be transmitted.
785  */
786 
787  int r;
788  struct sockaddr_in addr;
789 
791  ASSERT_EQ(r, 0);
792 
793  uv_pipe_open(&channel, 0);
794 
798 
800  ASSERT_EQ(r, 0);
801 
802  ASSERT_EQ(0, uv_ip4_addr("0.0.0.0", TEST_PORT, &addr));
803 
804  r = uv_tcp_bind(&tcp_server, (const struct sockaddr*) &addr, 0);
805  ASSERT_EQ(r, 0);
806 
808  ASSERT_EQ(r, 0);
809 
810  /* Make a connection to the server */
812  ASSERT_EQ(r, 0);
813 
814  ASSERT_EQ(0, uv_ip4_addr("127.0.0.1", TEST_PORT, &addr));
815 
817  (uv_tcp_t*) &conn.conn,
818  (const struct sockaddr*) &addr,
820  ASSERT_EQ(r, 0);
821 
823  ASSERT_EQ(r, 0);
824 
828 
830  return 0;
831 }
832 
833 static unsigned int write_until_data_queued() {
834  unsigned int i;
835  int r;
836 
837  i = 0;
838  do {
839  r = uv_write(&write_reqs[i],
840  (uv_stream_t*)&channel,
841  &large_buf,
842  1,
844  ASSERT_EQ(r, 0);
845  i++;
846  } while (channel.write_queue_size == 0 &&
847  i < ARRAY_SIZE(write_reqs));
848 
849  return channel.write_queue_size;
850 }
851 
852 static void send_handle_and_close() {
853  int r;
854  struct sockaddr_in addr;
855 
857  ASSERT_EQ(r, 0);
858 
859  ASSERT_EQ(0, uv_ip4_addr("0.0.0.0", TEST_PORT, &addr));
860 
861  r = uv_tcp_bind(&tcp_server, (const struct sockaddr*) &addr, 0);
862  ASSERT_EQ(r, 0);
863 
864  r = uv_write2(&write_req,
865  (uv_stream_t*)&channel,
866  &large_buf,
867  1,
870  ASSERT_EQ(r, 0);
871 
872  uv_close((uv_handle_t*)&tcp_server, NULL);
873 }
874 
876  int r;
877 
878  memset(buffer, '.', LARGE_SIZE);
880 
882  ASSERT_EQ(r, 0);
883 
884  uv_pipe_open(&channel, 0);
885 
889 
890  if (write_until_data_queued() > 0)
892 
894  ASSERT_EQ(r, 0);
895 
897 
899  return 0;
900 }
901 
902 
904  /*
905  * This is launched from test-ipc.c. stdin is a duplex channel
906  * over which two handles will be transmitted.
907  */
908  struct sockaddr_in addr;
909  int r;
910  uv_buf_t buf;
911 
912  ASSERT_EQ(0, uv_ip4_addr("0.0.0.0", TEST_PORT, &addr));
913 
915  ASSERT_EQ(r, 0);
916 
917  uv_pipe_open(&channel, 0);
918 
922 
923  buf = uv_buf_init("hello\n", 6);
924 
926  ASSERT_EQ(r, 0);
928  ASSERT_EQ(r, 0);
929 
930  r = uv_tcp_bind(&tcp_server, (const struct sockaddr*) &addr, 0);
931  ASSERT_EQ(r, 0);
932  r = uv_tcp_bind(&tcp_server2, (const struct sockaddr*) &addr, 0);
933  ASSERT_EQ(r, 0);
934 
936  (uv_stream_t*)&tcp_server, NULL);
937  ASSERT_EQ(r, 0);
939  (uv_stream_t*)&tcp_server2, NULL);
940  ASSERT_EQ(r, 0);
941 
943  ASSERT_EQ(r, 0);
944 
946  return 0;
947 }
948 
950  int r;
951  uv_buf_t zero_buf;
952 
953  zero_buf = uv_buf_init(0, 0);
954 
956  ASSERT_EQ(r, 0);
957 
958  uv_pipe_open(&channel, 0);
959 
963 
964  r = uv_write(&write_req,
965  (uv_stream_t*)&channel,
966  &zero_buf,
967  1,
969 
970  ASSERT_EQ(r, 0);
971 
973  ASSERT_EQ(r, 0);
974 
976 
978  return 0;
979 }
write_reqs
static uv_write_t write_reqs[300]
Definition: test-ipc.c:64
uv_pipe_pending_count
UV_EXTERN int uv_pipe_pending_count(uv_pipe_t *handle)
Definition: unix/pipe.c:298
closed_handle_write
static int closed_handle_write
Definition: test-ipc.c:49
uv_process_options_s
Definition: uv.h:940
on_tcp_read
static void on_tcp_read(uv_stream_t *tcp, ssize_t nread, const uv_buf_t *buf)
Definition: test-ipc.c:348
close_cb_called
static int close_cb_called
Definition: test-ipc.c:44
write_req
static uv_write_t write_req
Definition: test-ipc.c:41
ASSERT_NE
#define ASSERT_NE(val1, val2)
Definition: bloaty/third_party/googletest/googletest/include/gtest/gtest.h:2060
uv_process_s
Definition: uv.h:1037
write_req2
static uv_write_t write_req2
Definition: test-ipc.c:42
ARRAY_SIZE
#define ARRAY_SIZE(array)
Definition: bloaty.cc:101
task.h
read_cb
static void read_cb(uv_stream_t *stream, ssize_t nread, const uv_buf_t *buf)
Definition: benchmark-pound.c:138
TEST_IMPL
TEST_IMPL(ipc_listen_before_write)
Definition: test-ipc.c:463
memset
return memset(p, 0, total)
UV_READABLE_PIPE
@ UV_READABLE_PIPE
Definition: uv.h:921
ipc_on_connection_tcp_conn
static void ipc_on_connection_tcp_conn(uv_stream_t *server, int status)
Definition: test-ipc.c:696
uv_pipe_init
UV_EXTERN int uv_pipe_init(uv_loop_t *, uv_pipe_t *handle, int ipc)
Definition: unix/pipe.c:33
ipc_on_connection
static void ipc_on_connection(uv_stream_t *server, int status)
Definition: test-ipc.c:666
uv_handle_type
uv_handle_type
Definition: uv.h:189
uv_connect_s
Definition: uv.h:580
tcp_conn_write_cb_called
static int tcp_conn_write_cb_called
Definition: test-ipc.c:47
connect_child_process_cb
static void connect_child_process_cb(uv_connect_t *req, int status)
Definition: test-ipc.c:657
tcp_server_listening
static int tcp_server_listening
Definition: test-ipc.c:40
send_zero_write
static int send_zero_write
Definition: test-ipc.c:50
ipc_helper_tcp_connection
int ipc_helper_tcp_connection(void)
Definition: test-ipc.c:781
on_read_send_zero
static void on_read_send_zero(uv_stream_t *handle, ssize_t nread, const uv_buf_t *buf)
Definition: test-ipc.c:440
string.h
options
double_dict options[]
Definition: capstone_test.c:55
outbuf
unsigned char outbuf[SIZE]
Definition: bloaty/third_party/zlib/examples/gun.c:162
buf
voidpf void * buf
Definition: bloaty/third_party/zlib/contrib/minizip/ioapi.h:136
tcp_connection_write_cb
static void tcp_connection_write_cb(uv_write_t *req, int status)
Definition: test-ipc.c:596
uv_listen
UV_EXTERN int uv_listen(uv_stream_t *stream, int backlog, uv_connection_cb cb)
Definition: unix/stream.c:656
printf
_Use_decl_annotations_ int __cdecl printf(const char *_Format,...)
Definition: cs_driver.c:91
tcp_server2
static uv_tcp_t tcp_server2
Definition: test-ipc.c:30
uv_tcp_simultaneous_accepts
UV_EXTERN int uv_tcp_simultaneous_accepts(uv_tcp_t *handle, int enable)
Definition: unix/tcp.c:447
uv_connect_s::handle
uv_stream_t * handle
Definition: uv.h:583
ASSERT
#define ASSERT(expr)
Definition: task.h:102
uv_read_cb
void(* uv_read_cb)(uv_stream_t *stream, ssize_t nread, const uv_buf_t *buf)
Definition: uv.h:309
tcp_conn::tcp_write_req
uv_write_t tcp_write_req
Definition: test-ipc.c:54
tcp
static uv_tcp_t tcp
Definition: test-connection-fail.c:29
large_buf
static uv_buf_t large_buf
Definition: test-ipc.c:62
close_server_conn_cb
static void close_server_conn_cb(uv_handle_t *handle)
Definition: test-ipc.c:71
status
absl::Status status
Definition: rls.cc:251
connect_cb
static void connect_cb(uv_connect_t *req, int status)
Definition: test-ipc.c:125
uv_strerror
const UV_EXTERN char * uv_strerror(int err)
Definition: uv-common.c:212
write_req
Definition: benchmark-tcp-write-batch.c:31
xds_manager.p
p
Definition: xds_manager.py:60
close_client_conn_cb
static void close_client_conn_cb(uv_handle_t *handle)
Definition: test-ipc.c:119
CONN_COUNT
#define CONN_COUNT
Definition: test-ipc.c:58
uv_run
UV_EXTERN int uv_run(uv_loop_t *, uv_run_mode mode)
Definition: unix/core.c:361
uv_is_closing
UV_EXTERN int uv_is_closing(const uv_handle_t *handle)
Definition: unix/core.c:319
grpc_core::pending
P< T > pending()
Definition: try_join_test.cc:50
make_many_connections
static void make_many_connections(void)
Definition: test-ipc.c:130
on_alloc
static void on_alloc(uv_handle_t *handle, size_t suggested_size, uv_buf_t *buf)
Definition: test-ipc.c:111
uv_tcp_bind
UV_EXTERN int uv_tcp_bind(uv_tcp_t *handle, const struct sockaddr *addr, unsigned int flags)
Definition: uv-common.c:277
TEST_PORT
#define TEST_PORT
Definition: task.h:53
python_utils.port_server.stderr
stderr
Definition: port_server.py:51
uv_close
UV_EXTERN void uv_close(uv_handle_t *handle, uv_close_cb close_cb)
Definition: unix/core.c:112
uv_stream_s
Definition: uv.h:491
read_cb_called
static int read_cb_called
Definition: test-ipc.c:34
uv_tcp_connect
UV_EXTERN int uv_tcp_connect(uv_connect_t *req, uv_tcp_t *handle, const struct sockaddr *addr, uv_connect_cb cb)
Definition: uv-common.c:315
uv_ip4_addr
UV_EXTERN int uv_ip4_addr(const char *ip, int port, struct sockaddr_in *addr)
Definition: uv-common.c:221
close_cb
static void close_cb(uv_handle_t *handle)
Definition: test-ipc.c:585
exepath
static char exepath[1024]
Definition: benchmark-spawn.c:34
UV_WRITABLE_PIPE
@ UV_WRITABLE_PIPE
Definition: uv.h:922
on_tcp_child_process_read
static void on_tcp_child_process_read(uv_stream_t *tcp, ssize_t nread, const uv_buf_t *buf)
Definition: test-ipc.c:627
server
std::unique_ptr< Server > server
Definition: channelz_service_test.cc:330
uv_default_loop
UV_EXTERN uv_loop_t * uv_default_loop(void)
Definition: uv-common.c:733
tcp_conn::conn
uv_tcp_t conn
Definition: test-ipc.c:55
ipc_helper
int ipc_helper(int listen_after_write)
Definition: test-ipc.c:728
ssize_t
intptr_t ssize_t
Definition: win.h:27
asyncio_get_stats.args
args
Definition: asyncio_get_stats.py:40
process
static uv_process_t process
Definition: benchmark-spawn.c:32
LARGE_SIZE
#define LARGE_SIZE
Definition: test-ipc.c:60
uv_stdio_container_s::flags
uv_stdio_flags flags
Definition: uv.h:932
conn_notify_write_cb
static void conn_notify_write_cb(uv_write_t *req, int status)
Definition: test-ipc.c:590
int64_t
signed __int64 int64_t
Definition: stdint-msvc2008.h:89
on_read_connection
static void on_read_connection(uv_stream_t *handle, ssize_t nread, const uv_buf_t *buf)
Definition: test-ipc.c:361
local_conn_accepted
static int local_conn_accepted
Definition: test-ipc.c:38
ipc_helper_send_zero
int ipc_helper_send_zero(void)
Definition: test-ipc.c:949
uv_write
UV_EXTERN int uv_write(uv_write_t *req, uv_stream_t *handle, const uv_buf_t bufs[], unsigned int nbufs, uv_write_cb cb)
Definition: unix/stream.c:1492
uv_is_readable
UV_EXTERN int uv_is_readable(const uv_stream_t *handle)
Definition: unix/stream.c:1606
req
static uv_connect_t req
Definition: test-connection-fail.c:30
tcp_connection
static uv_tcp_t tcp_connection
Definition: test-ipc.c:31
UV_RUN_DEFAULT
@ UV_RUN_DEFAULT
Definition: uv.h:254
closed_handle_large_write_cb
static void closed_handle_large_write_cb(uv_write_t *req, int status)
Definition: test-ipc.c:605
UV_INHERIT_FD
@ UV_INHERIT_FD
Definition: uv.h:913
spawn_helper
void spawn_helper(uv_pipe_t *channel, uv_process_t *process, const char *helper)
Definition: test-ipc.c:291
ipc_helper_bind_twice
int ipc_helper_bind_twice(void)
Definition: test-ipc.c:903
on_tcp_write
static void on_tcp_write(uv_write_t *req, int status)
Definition: test-ipc.c:333
uv_read_start
UV_EXTERN int uv_read_start(uv_stream_t *, uv_alloc_cb alloc_cb, uv_read_cb read_cb)
Definition: unix/stream.c:1555
tcp_server
static uv_tcp_t tcp_server
Definition: test-ipc.c:29
send_zero_write_cb
static void send_zero_write_cb(uv_write_t *req, int status)
Definition: test-ipc.c:622
tcp_write_cb_called
static int tcp_write_cb_called
Definition: test-ipc.c:35
tcp_conn
Definition: test-ipc.c:52
uv_tcp_init
UV_EXTERN int uv_tcp_init(uv_loop_t *, uv_tcp_t *handle)
Definition: unix/tcp.c:143
uv_accept
UV_EXTERN int uv_accept(uv_stream_t *server, uv_stream_t *client)
Definition: unix/stream.c:591
uv_stdio_container_s
Definition: uv.h:931
uv_stdio_container_s::fd
int fd
Definition: uv.h:936
on_read_closed_handle
static void on_read_closed_handle(uv_stream_t *handle, ssize_t nread, const uv_buf_t *buf)
Definition: test-ipc.c:421
ASSERT_NOT_NULL
#define ASSERT_NOT_NULL(a)
Definition: task.h:217
uv_tcp_s
Definition: uv.h:544
uv_spawn
UV_EXTERN int uv_spawn(uv_loop_t *loop, uv_process_t *handle, const uv_process_options_t *options)
Definition: unix/process.c:408
notify_parent_process
void notify_parent_process(void)
Definition: runner-unix.c:54
uv_exepath
UV_EXTERN int uv_exepath(char *buffer, size_t *size)
Definition: aix-common.c:79
channel
static uv_pipe_t channel
Definition: test-ipc.c:28
ipc_helper_closed_handle
int ipc_helper_closed_handle(void)
Definition: test-ipc.c:875
uv_stdio_container_s::stream
uv_stream_t * stream
Definition: uv.h:935
closed_handle_write_cb
static void closed_handle_write_cb(uv_write_t *req, int status)
Definition: test-ipc.c:616
uv.h
tcp_conn::conn_req
uv_connect_t conn_req
Definition: test-ipc.c:53
MAKE_VALGRIND_HAPPY
#define MAKE_VALGRIND_HAPPY()
Definition: task.h:229
ASSERT_PTR_EQ
#define ASSERT_PTR_EQ(a, b)
Definition: task.h:220
on_connection
static void on_connection(uv_stream_t *server, int status)
Definition: test-ipc.c:76
exepath_size
static size_t exepath_size
Definition: benchmark-spawn.c:35
BACKLOG
#define BACKLOG
Definition: test-ipc.c:59
uv_buf_t
Definition: unix.h:121
exit_cb_called
static int exit_cb_called
Definition: test-ipc.c:33
server
Definition: examples/python/async_streaming/server.py:1
write_reqs_completed
static int write_reqs_completed
Definition: test-ipc.c:65
on_read_alloc
static void on_read_alloc(uv_handle_t *handle, size_t suggested_size, uv_buf_t *buf)
Definition: test-ipc.c:340
uv_pipe_pending_type
UV_EXTERN uv_handle_type uv_pipe_pending_type(uv_pipe_t *handle)
Definition: unix/pipe.c:315
fix_build_deps.r
r
Definition: fix_build_deps.py:491
uv_pipe_s::ipc
UV_HANDLE_FIELDS UV_STREAM_FIELDS int ipc
Definition: uv.h:760
exit_cb
static void exit_cb(uv_process_t *process, int64_t exit_status, int term_signal)
Definition: test-ipc.c:100
uv_pipe_s
Definition: uv.h:757
uv_buf_init
UV_EXTERN uv_buf_t uv_buf_init(char *base, unsigned int len)
Definition: uv-common.c:157
tcp_read_cb_called
static int tcp_read_cb_called
Definition: test-ipc.c:36
closed_handle_data_read
static int closed_handle_data_read
Definition: test-ipc.c:48
UV_CREATE_PIPE
@ UV_CREATE_PIPE
Definition: uv.h:912
uv_write_s
Definition: uv.h:522
connection_accepted
static int connection_accepted
Definition: test-ipc.c:45
ASSERT_MEM_EQ
#define ASSERT_MEM_EQ(a, b, size)
Definition: task.h:202
RETURN_SKIP
#define RETURN_SKIP(explanation)
Definition: task.h:262
uv_stdio_container_s::data
union uv_stdio_container_s::@399 data
remote_conn_accepted
static int remote_conn_accepted
Definition: test-ipc.c:39
handle
static csh handle
Definition: test_arm_regression.c:16
uv_handle_s
Definition: uv.h:441
on_pipe_read_called
static int on_pipe_read_called
Definition: test-ipc.c:37
uv_write2
UV_EXTERN int uv_write2(uv_write_t *req, uv_stream_t *handle, const uv_buf_t bufs[], unsigned int nbufs, uv_stream_t *send_handle, uv_write_cb cb)
Definition: unix/stream.c:1393
uv_is_writable
UV_EXTERN int uv_is_writable(const uv_stream_t *handle)
Definition: unix/stream.c:1611
ASSERT_GT
#define ASSERT_GT(val1, val2)
Definition: bloaty/third_party/googletest/googletest/include/gtest/gtest.h:2076
conn
static tcp_conn conn
Definition: test-ipc.c:582
on_read
static void on_read(uv_stream_t *handle, ssize_t nread, const uv_buf_t *buf)
Definition: test-ipc.c:154
run_ipc_test
static int run_ipc_test(const char *helper, uv_read_cb read_cb)
Definition: test-ipc.c:448
buffer
static char buffer[LARGE_SIZE]
Definition: test-ipc.c:63
conn_notify_req
static uv_write_t conn_notify_req
Definition: test-ipc.c:43
uv_pipe_open
UV_EXTERN int uv_pipe_open(uv_pipe_t *, uv_file file)
Definition: unix/pipe.c:137
addr
struct sockaddr_in addr
Definition: libuv/docs/code/tcp-echo-server/main.c:10
send_handle_and_close
static void send_handle_and_close(void)
Definition: test-ipc.c:852
write_until_data_queued
static unsigned int write_until_data_queued(void)
Definition: test-ipc.c:833
i
uint64_t i
Definition: abseil-cpp/absl/container/btree_benchmark.cc:230
ASSERT_EQ
#define ASSERT_EQ(val1, val2)
Definition: bloaty/third_party/googletest/googletest/include/gtest/gtest.h:2056
tcp_conn_read_cb_called
static int tcp_conn_read_cb_called
Definition: test-ipc.c:46
UV_UNKNOWN_HANDLE
@ UV_UNKNOWN_HANDLE
Definition: uv.h:190


grpc
Author(s):
autogenerated on Thu Mar 13 2025 03:01:30