Browse Source

Revert "Add APIs for non thread safe usage of shadowsocks-libev library"

This reverts commit 3e4c922363.
pull/677/head
Max Lv 8 years ago
parent
commit
00209ab2ea
2 changed files with 0 additions and 54 deletions
  1. 34
      src/local.c
  2. 20
      src/shadowsocks.h

34
src/local.c

@ -940,9 +940,6 @@ static void signal_cb(EV_P_ ev_signal *w, int revents)
switch (w->signum) {
case SIGINT:
case SIGTERM:
#ifndef __MINGW32__
case SIGUSR1:
#endif
ev_unloop(EV_A_ EVUNLOOP_ALL);
}
}
@ -1284,27 +1281,6 @@ int main(int argc, char **argv)
#else
static int running = 0;
static ev_timer state_watcher;
static void state_timeout_cb(EV_P_ ev_timer *watcher, int revents)
{
if (!running) {
ev_timer_stop(EV_A_ watcher);
ev_unloop(EV_A_ EVUNLOOP_ALL);
}
}
int stop_ss_local_server() {
int ret = running ? 0 : -1;
running = 0;
return ret;
}
int is_ss_local_server_running() {
return running;
}
int start_ss_local_server(profile_t profile)
{
srand(time(NULL));
@ -1353,12 +1329,6 @@ int start_ss_local_server(profile_t profile)
ev_signal_start(EV_DEFAULT, &sigint_watcher);
ev_signal_start(EV_DEFAULT, &sigterm_watcher);
#ifndef __MINGW32__
struct ev_signal sigusr1_watcher;
ev_signal_init(&sigusr1_watcher, signal_cb, SIGUSR1);
ev_signal_start(EV_DEFAULT, &sigusr1_watcher);
#endif
// Setup keys
LOGI("initializing ciphers... %s", method);
int m = enc_init(password, method);
@ -1411,10 +1381,6 @@ int start_ss_local_server(profile_t profile)
// Init connections
cork_dllist_init(&connections);
// Init state watcher
ev_timer_init(&state_watcher, state_timeout_cb, 1, 1);
ev_timer_start(loop, &state_watcher);
// Enter the loop
ev_run(loop, 0);

20
src/shadowsocks.h

@ -77,26 +77,6 @@ extern "C" {
*/
int start_ss_local_server(profile_t profile);
/*
* Stop the current shadowsocks local server.
*
* If failed, -1 is returned. Otherwise 0 is returned.
*
* This function is not thread safe. It's usable only if the server started
* in the same process.
*/
int stop_ss_local_server();
/*
* Get the state of the current shadowsocks local server.
*
* If running, 1 is returned. Otherwise, 0 is returned.
*
* This function is not thread safe. It's usable only if the server started
* in the same process.
*/
int is_ss_local_server_running();
#ifdef __cplusplus
}
#endif

Loading…
Cancel
Save