|
@@ -236,6 +236,12 @@ static int create_server_sockect (int server_port)
|
|
|
return listener;
|
|
return listener;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+static int32_t sig_exit_handler (int num, void *data)
|
|
|
|
|
+{
|
|
|
|
|
+ qb_loop_stop(poll_handle);
|
|
|
|
|
+ return 0;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
int test_agent_run(int server_port, ta_do_command_fn func)
|
|
int test_agent_run(int server_port, ta_do_command_fn func)
|
|
|
{
|
|
{
|
|
|
int listener;
|
|
int listener;
|
|
@@ -243,6 +249,13 @@ int test_agent_run(int server_port, ta_do_command_fn func)
|
|
|
do_command = func;
|
|
do_command = func;
|
|
|
poll_handle = qb_loop_create ();
|
|
poll_handle = qb_loop_create ();
|
|
|
|
|
|
|
|
|
|
+ qb_loop_signal_add(poll_handle, QB_LOOP_HIGH,
|
|
|
|
|
+ SIGINT, NULL, sig_exit_handler, NULL);
|
|
|
|
|
+ qb_loop_signal_add(poll_handle, QB_LOOP_HIGH,
|
|
|
|
|
+ SIGQUIT, NULL, sig_exit_handler, NULL);
|
|
|
|
|
+ qb_loop_signal_add(poll_handle, QB_LOOP_HIGH,
|
|
|
|
|
+ SIGTERM, NULL, sig_exit_handler, NULL);
|
|
|
|
|
+
|
|
|
listener = create_server_sockect (server_port);
|
|
listener = create_server_sockect (server_port);
|
|
|
qb_loop_poll_add (poll_handle,
|
|
qb_loop_poll_add (poll_handle,
|
|
|
QB_LOOP_MED,
|
|
QB_LOOP_MED,
|