mirror of
https://github.com/shadowsocks/shadowsocks-libev.git
synced 2026-11-27 18:04:07 +00:00
format with .uncrustify.cfg (#1759)
* format with .uncrustify.cfg format with .uncrustify.cfg * format with .uncrustify.cfg * format with .uncrustify.cfg exclude json.* base64.* uthash.h * format with .uncrustify.cfg exclude json.* base64.* uthash.h
This commit is contained in:
+29
-26
@@ -83,12 +83,17 @@ setnonblocking(int fd)
|
||||
}
|
||||
|
||||
static void
|
||||
destroy_server(struct server *server) {
|
||||
destroy_server(struct server *server)
|
||||
{
|
||||
// function used to free memories alloced in **get_server**
|
||||
if (server->method) ss_free(server->method);
|
||||
if (server->plugin) ss_free(server->plugin);
|
||||
if (server->plugin_opts) ss_free(server->plugin_opts);
|
||||
if (server->mode) ss_free(server->mode);
|
||||
if (server->method)
|
||||
ss_free(server->method);
|
||||
if (server->plugin)
|
||||
ss_free(server->plugin);
|
||||
if (server->plugin_opts)
|
||||
ss_free(server->plugin_opts);
|
||||
if (server->mode)
|
||||
ss_free(server->mode);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -465,11 +470,10 @@ check_port(struct manager_ctx *manager, struct server *server)
|
||||
}
|
||||
|
||||
/* clean socks */
|
||||
for (int i = 0; i < fd_count; i++) {
|
||||
for (int i = 0; i < fd_count; i++)
|
||||
if (sock_fds[i] > 0) {
|
||||
close(sock_fds[i]);
|
||||
}
|
||||
}
|
||||
|
||||
ss_free(sock_fds);
|
||||
|
||||
@@ -630,7 +634,7 @@ manager_recv_cb(EV_P_ ev_io *w, int revents)
|
||||
ERROR("add_sendto");
|
||||
}
|
||||
} else if (strcmp(action, "list") == 0) {
|
||||
struct cork_hash_table_iterator iter;
|
||||
struct cork_hash_table_iterator iter;
|
||||
struct cork_hash_table_entry *entry;
|
||||
char buf[BUF_SIZE];
|
||||
memset(buf, 0, BUF_SIZE);
|
||||
@@ -639,10 +643,10 @@ manager_recv_cb(EV_P_ ev_io *w, int revents)
|
||||
cork_hash_table_iterator_init(server_table, &iter);
|
||||
while ((entry = cork_hash_table_iterator_next(&iter)) != NULL) {
|
||||
struct server *server = (struct server *)entry->value;
|
||||
char *method = server->method?server->method:manager->method;
|
||||
size_t pos = strlen(buf);
|
||||
size_t entry_len = strlen(server->port) + strlen(server->password) + strlen(method);
|
||||
if (pos > BUF_SIZE-entry_len-50) {
|
||||
char *method = server->method ? server->method : manager->method;
|
||||
size_t pos = strlen(buf);
|
||||
size_t entry_len = strlen(server->port) + strlen(server->password) + strlen(method);
|
||||
if (pos > BUF_SIZE - entry_len - 50) {
|
||||
if (sendto(manager->fd, buf, pos, 0, (struct sockaddr *)&claddr, len)
|
||||
!= pos) {
|
||||
ERROR("list_sendto");
|
||||
@@ -650,13 +654,12 @@ manager_recv_cb(EV_P_ ev_io *w, int revents)
|
||||
memset(buf, 0, BUF_SIZE);
|
||||
pos = 0;
|
||||
}
|
||||
sprintf(buf + pos, "\n\t{\"server_port\":\"%s\",\"password\":\"%s\",\"method\":\"%s\"},",
|
||||
server->port,server->password,method);
|
||||
|
||||
sprintf(buf + pos, "\n\t{\"server_port\":\"%s\",\"password\":\"%s\",\"method\":\"%s\"},",
|
||||
server->port, server->password, method);
|
||||
}
|
||||
|
||||
size_t pos = strlen(buf);
|
||||
strcpy(buf + pos - 1, "\n]"); //Remove trailing ","
|
||||
strcpy(buf + pos - 1, "\n]"); // Remove trailing ","
|
||||
pos = strlen(buf);
|
||||
if (sendto(manager->fd, buf, pos, 0, (struct sockaddr *)&claddr, len)
|
||||
!= pos) {
|
||||
@@ -864,19 +867,19 @@ main(int argc, char **argv)
|
||||
jconf_t *conf = NULL;
|
||||
|
||||
static struct option long_options[] = {
|
||||
{ "fast-open", no_argument, NULL, GETOPT_VAL_FAST_OPEN },
|
||||
{ "reuse-port", no_argument, NULL, GETOPT_VAL_REUSE_PORT },
|
||||
{ "acl", required_argument, NULL, GETOPT_VAL_ACL },
|
||||
{ "fast-open", no_argument, NULL, GETOPT_VAL_FAST_OPEN },
|
||||
{ "reuse-port", no_argument, NULL, GETOPT_VAL_REUSE_PORT },
|
||||
{ "acl", required_argument, NULL, GETOPT_VAL_ACL },
|
||||
{ "manager-address", required_argument, NULL,
|
||||
GETOPT_VAL_MANAGER_ADDRESS },
|
||||
GETOPT_VAL_MANAGER_ADDRESS },
|
||||
{ "executable", required_argument, NULL,
|
||||
GETOPT_VAL_EXECUTABLE },
|
||||
{ "mtu", required_argument, NULL, GETOPT_VAL_MTU },
|
||||
{ "plugin", required_argument, NULL, GETOPT_VAL_PLUGIN },
|
||||
GETOPT_VAL_EXECUTABLE },
|
||||
{ "mtu", required_argument, NULL, GETOPT_VAL_MTU },
|
||||
{ "plugin", required_argument, NULL, GETOPT_VAL_PLUGIN },
|
||||
{ "plugin-opts", required_argument, NULL, GETOPT_VAL_PLUGIN_OPTS },
|
||||
{ "password", required_argument, NULL, GETOPT_VAL_PASSWORD },
|
||||
{ "help", no_argument, NULL, GETOPT_VAL_HELP },
|
||||
{ NULL, 0, NULL, 0 }
|
||||
{ "password", required_argument, NULL, GETOPT_VAL_PASSWORD },
|
||||
{ "help", no_argument, NULL, GETOPT_VAL_HELP },
|
||||
{ NULL, 0, NULL, 0 }
|
||||
};
|
||||
|
||||
opterr = 0;
|
||||
|
||||
Reference in New Issue
Block a user