mirror of
https://github.com/shadowsocks/shadowsocks-libev.git
synced 2026-11-24 06:53:45 +00:00
Fix #690
This commit is contained in:
+16
-7
@@ -80,6 +80,8 @@
|
||||
#endif
|
||||
|
||||
int verbose = 0;
|
||||
int keep_resolving = 1;
|
||||
|
||||
#ifdef ANDROID
|
||||
int vpn = 0;
|
||||
uint64_t tx = 0;
|
||||
@@ -969,6 +971,10 @@ void accept_cb(EV_P_ ev_io *w, int revents)
|
||||
ev_io_start(EV_A_ & server->recv_ctx->io);
|
||||
}
|
||||
|
||||
void resolve_int_cb(int dummy) {
|
||||
keep_resolving = 0;
|
||||
}
|
||||
|
||||
#ifndef LIB_ONLY
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
@@ -1185,15 +1191,9 @@ int main(int argc, char **argv)
|
||||
// ignore SIGPIPE
|
||||
signal(SIGPIPE, SIG_IGN);
|
||||
signal(SIGABRT, SIG_IGN);
|
||||
signal(SIGINT, resolve_int_cb);
|
||||
#endif
|
||||
|
||||
struct ev_signal sigint_watcher;
|
||||
struct ev_signal sigterm_watcher;
|
||||
ev_signal_init(&sigint_watcher, signal_cb, SIGINT);
|
||||
ev_signal_init(&sigterm_watcher, signal_cb, SIGTERM);
|
||||
ev_signal_start(EV_DEFAULT, &sigint_watcher);
|
||||
ev_signal_start(EV_DEFAULT, &sigterm_watcher);
|
||||
|
||||
// Setup keys
|
||||
LOGI("initializing ciphers... %s", method);
|
||||
int m = enc_init(password, method);
|
||||
@@ -1217,6 +1217,15 @@ int main(int argc, char **argv)
|
||||
listen_ctx.iface = iface;
|
||||
listen_ctx.method = m;
|
||||
|
||||
// Setup signal handler
|
||||
struct ev_signal sigint_watcher;
|
||||
struct ev_signal sigterm_watcher;
|
||||
ev_signal_init(&sigint_watcher, signal_cb, SIGINT);
|
||||
ev_signal_init(&sigterm_watcher, signal_cb, SIGTERM);
|
||||
ev_signal_start(EV_DEFAULT, &sigint_watcher);
|
||||
ev_signal_start(EV_DEFAULT, &sigterm_watcher);
|
||||
|
||||
|
||||
struct ev_loop *loop = EV_DEFAULT;
|
||||
|
||||
// Setup socket
|
||||
|
||||
Reference in New Issue
Block a user