|
71 | 71 | #include "plugin/group_replication/libmysqlgcs/src/bindings/xcom/xcom/task_net.h"
|
72 | 72 | #include "plugin/group_replication/libmysqlgcs/src/bindings/xcom/xcom/task_os.h"
|
73 | 73 | #include "plugin/group_replication/libmysqlgcs/src/bindings/xcom/xcom/xcom_cfg.h"
|
| 74 | +#include "plugin/group_replication/libmysqlgcs/src/bindings/xcom/xcom/site_def.h" |
| 75 | +#include "plugin/group_replication/libmysqlgcs/src/bindings/xcom/xcom/xcom_base.h" |
74 | 76 |
|
75 | 77 | #ifndef _WIN32
|
76 | 78 | #include <poll.h>
|
@@ -935,11 +937,22 @@ static int msdiff(double time) {
|
935 | 937 | return (int)(1000.5 * (first_delayed()->time - time));
|
936 | 938 | }
|
937 | 939 |
|
| 940 | +static should_exit_getter get_should_exit; |
| 941 | + |
| 942 | +void set_should_exit_getter(should_exit_getter x) { get_should_exit = x; } |
| 943 | + |
938 | 944 | static double idle_time = 0.0;
|
939 | 945 | void task_loop() {
|
| 946 | + task_env *t = 0; |
940 | 947 | /* While there are tasks */
|
941 | 948 | for (;;) {
|
942 |
| - task_env *t = first_runnable(); |
| 949 | + //check forced exit callback |
| 950 | + if(get_should_exit()) |
| 951 | + { |
| 952 | + xcom_fsm(xa_exit, int_arg(0)); |
| 953 | + } |
| 954 | + |
| 955 | + t = first_runnable(); |
943 | 956 | /* While runnable tasks */
|
944 | 957 | while (runnable_tasks()) {
|
945 | 958 | task_env *next = next_task(t);
|
@@ -1023,9 +1036,9 @@ static int init_sockaddr(char *server, struct sockaddr_in *sock_addr,
|
1023 | 1036 | socklen_t *sock_size, xcom_port port) {
|
1024 | 1037 | /* Get address of server */
|
1025 | 1038 | struct addrinfo *addr = 0;
|
1026 |
| - |
| 1039 | + |
1027 | 1040 | checked_getaddrinfo(server, 0, 0, &addr);
|
1028 |
| - |
| 1041 | + |
1029 | 1042 | if (!addr) return 0;
|
1030 | 1043 | /* Copy first address */
|
1031 | 1044 | memcpy(sock_addr, addr->ai_addr, addr->ai_addrlen);
|
|
0 commit comments