mirror of
https://github.com/shadowsocks/shadowsocks-libev.git
synced 2026-10-29 20:43:44 +00:00
refine output
This commit is contained in:
+2
-2
@@ -1063,7 +1063,7 @@ int main(int argc, char **argv)
|
||||
FATAL("listen() error");
|
||||
}
|
||||
setnonblocking(listenfd);
|
||||
LOGI("server listening at port %s", local_port);
|
||||
LOGI("listening at %s:%s", local_addr, local_port);
|
||||
|
||||
// Setup proxy context
|
||||
struct listen_ctx listen_ctx;
|
||||
@@ -1196,7 +1196,7 @@ int start_ss_local_server(profile_t profile)
|
||||
return -1;
|
||||
}
|
||||
setnonblocking(listenfd);
|
||||
LOGI("server listening at port %s", local_port_str);
|
||||
LOGI("listening at %s:%s", local_addr, local_port_str);
|
||||
|
||||
// Setup proxy context
|
||||
struct listen_ctx listen_ctx;
|
||||
|
||||
+1
-1
@@ -719,7 +719,7 @@ int main(int argc, char **argv)
|
||||
FATAL("listen() error");
|
||||
}
|
||||
setnonblocking(listenfd);
|
||||
LOGI("server listening at port %s", local_port);
|
||||
LOGI("listening at %s:%s", local_addr, local_port);
|
||||
|
||||
// Setup proxy context
|
||||
struct listen_ctx listen_ctx;
|
||||
|
||||
+12
-8
@@ -1197,6 +1197,10 @@ int main(int argc, char **argv)
|
||||
resolv_init(loop, nameservers, nameserver_num);
|
||||
}
|
||||
|
||||
for (int i = 0; i < nameserver_num; i++) {
|
||||
LOGI("using nameserver: %s", nameservers[i]);
|
||||
}
|
||||
|
||||
// inilitialize listen context
|
||||
struct listen_ctx listen_ctx_list[server_num];
|
||||
|
||||
@@ -1215,11 +1219,7 @@ int main(int argc, char **argv)
|
||||
FATAL("listen() error");
|
||||
}
|
||||
setnonblocking(listenfd);
|
||||
LOGI("server listening at port %s", server_port);
|
||||
|
||||
for (int i = 0; i < nameserver_num; i++) {
|
||||
LOGI("using nameserver: %s", nameservers[i]);
|
||||
}
|
||||
LOGI("listening at %s:%s", host, server_port);
|
||||
|
||||
struct listen_ctx *listen_ctx = &listen_ctx_list[index];
|
||||
|
||||
@@ -1232,13 +1232,17 @@ int main(int argc, char **argv)
|
||||
|
||||
ev_io_init(&listen_ctx->io, accept_cb, listenfd, EV_READ);
|
||||
ev_io_start(loop, &listen_ctx->io);
|
||||
|
||||
// Setup UDP
|
||||
if (udprelay) {
|
||||
init_udprelay(server_host[index], server_port, m, atoi(timeout),
|
||||
iface);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Setup UDP
|
||||
if (udprelay) {
|
||||
LOGI("udprelay enabled");
|
||||
init_udprelay(server_host[0], server_port, m, atoi(timeout),
|
||||
iface);
|
||||
}
|
||||
|
||||
// setuid
|
||||
|
||||
+1
-1
@@ -784,7 +784,7 @@ int main(int argc, char **argv)
|
||||
FATAL("listen() error:");
|
||||
}
|
||||
setnonblocking(listenfd);
|
||||
LOGI("server listening at port %s", local_port);
|
||||
LOGI("listening at %s:%s", local_addr, local_port);
|
||||
|
||||
// Setup proxy context
|
||||
struct listen_ctx listen_ctx;
|
||||
|
||||
+8
-4
@@ -95,7 +95,8 @@ static struct remote_ctx * new_remote(int fd, struct server_ctx * server_ctx);
|
||||
|
||||
extern int verbose;
|
||||
|
||||
static struct server_ctx *server_ctx = NULL;
|
||||
static int server_num = 0;
|
||||
static struct server_ctx *server_ctx_list[MAX_REMOTE_NUM] = { NULL };
|
||||
|
||||
#ifndef __MINGW32__
|
||||
static int setnonblocking(int fd)
|
||||
@@ -973,7 +974,7 @@ int init_udprelay(const char *server_host, const char *server_port,
|
||||
}
|
||||
setnonblocking(serverfd);
|
||||
|
||||
server_ctx = new_server_ctx(serverfd);
|
||||
struct server_ctx *server_ctx = new_server_ctx(serverfd);
|
||||
#ifdef UDPRELAY_REMOTE
|
||||
server_ctx->loop = loop;
|
||||
#endif
|
||||
@@ -991,17 +992,20 @@ int init_udprelay(const char *server_host, const char *server_port,
|
||||
|
||||
ev_io_start(loop, &server_ctx->io);
|
||||
|
||||
server_ctx_list[server_num++] = server_ctx;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void free_udprelay()
|
||||
{
|
||||
struct ev_loop *loop = EV_DEFAULT;
|
||||
if (server_ctx != NULL) {
|
||||
while (server_num-- > 0) {
|
||||
struct server_ctx *server_ctx = server_ctx_list[server_num];
|
||||
ev_io_stop(loop, &server_ctx->io);
|
||||
close(server_ctx->fd);
|
||||
cache_delete(server_ctx->conn_cache, 0);
|
||||
free(server_ctx);
|
||||
server_ctx = NULL;
|
||||
server_ctx_list[server_num] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user