Browse Source

MinGW: fix socket closing in wrong place

pull/1995/head
Linus Yang 6 years ago
parent
commit
1f9dd2fbf4
1 changed files with 8 additions and 4 deletions
  1. 12
      src/local.c

12
src/local.c

@ -110,6 +110,7 @@ static struct ev_signal sigterm_watcher;
static struct ev_signal sigchld_watcher;
static struct ev_signal sigusr1_watcher;
#else
#ifndef LIB_ONLY
static struct plugin_watcher_t {
ev_io io;
SOCKET fd;
@ -117,6 +118,7 @@ static struct plugin_watcher_t {
int valid;
} plugin_watcher;
#endif
#endif
#ifdef HAVE_SETRLIMIT
#ifndef LIB_ONLY
@ -1323,7 +1325,9 @@ signal_cb(EV_P_ ev_signal *w, int revents)
ev_signal_stop(EV_DEFAULT, &sigchld_watcher);
ev_signal_stop(EV_DEFAULT, &sigusr1_watcher);
#else
#ifndef LIB_ONLY
ev_io_stop(EV_DEFAULT, &plugin_watcher.io);
#endif
#endif
keep_resolving = 0;
ev_unloop(EV_A_ EVUNLOOP_ALL);
@ -1890,6 +1894,10 @@ main(int argc, char **argv)
}
#ifdef __MINGW32__
if (plugin_watcher.valid) {
closesocket(plugin_watcher.fd);
}
winsock_cleanup();
#endif
@ -2039,10 +2047,6 @@ _start_ss_local_server(profile_t profile, ss_local_callback callback, void *udat
}
#ifdef __MINGW32__
if (plugin_watcher.valid) {
closesocket(plugin_watcher.fd);
}
winsock_cleanup();
#endif

Loading…
Cancel
Save