MCPcopy Create free account
hub / github.com/apache/thrift / test_server

Function test_server

lib/c_glib/test/testsimpleserver.c:75–108  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

73}
74
75static void
76test_server (void)
77{
78 int status;
79 pid_t pid;
80 TestProcessor *p = NULL;
81 ThriftServerSocket *tss = NULL;
82 ThriftSimpleServer *ss = NULL;
83
84 p = g_object_new (TEST_PROCESSOR_TYPE, NULL);
85 tss = g_object_new (THRIFT_TYPE_SERVER_SOCKET, "port", TEST_PORT, NULL);
86 ss = g_object_new (THRIFT_TYPE_SIMPLE_SERVER, "processor", p,
87 "server_transport", THRIFT_SERVER_TRANSPORT (tss), NULL);
88
89 /* run the server in a child process */
90 pid = fork ();
91 g_assert (pid >= 0);
92
93 if (pid == 0)
94 {
95 THRIFT_SERVER_GET_CLASS (THRIFT_SERVER (ss))->serve (THRIFT_SERVER (ss),
96 NULL);
97 exit (0);
98 } else {
99 sleep (5);
100 kill (pid, SIGINT);
101
102 g_object_unref (ss);
103 g_object_unref (tss);
104 g_object_unref (p);
105 g_assert (wait (&status) == pid);
106 g_assert (status == SIGINT);
107 }
108}
109
110int
111main(int argc, char *argv[])

Callers

nothing calls this directly

Calls 1

serveMethod · 0.45

Tested by

no test coverage detected