mirror of
https://github.com/shadowsocks/shadowsocks-libev.git
synced 2026-10-31 14:33:50 +00:00
Remove prefix option
This commit is contained in:
+6
-14
@@ -45,8 +45,6 @@
|
||||
#include "netutils.h"
|
||||
#include "utils.h"
|
||||
|
||||
extern char *prefix;
|
||||
|
||||
int
|
||||
protect_socket(int fd)
|
||||
{
|
||||
@@ -65,16 +63,13 @@ protect_socket(int fd)
|
||||
setsockopt(sock, SOL_SOCKET, SO_RCVTIMEO, (char *)&tv, sizeof(struct timeval));
|
||||
setsockopt(sock, SOL_SOCKET, SO_SNDTIMEO, (char *)&tv, sizeof(struct timeval));
|
||||
|
||||
char path[257];
|
||||
sprintf(path, "%s/protect_path", prefix);
|
||||
|
||||
memset(&addr, 0, sizeof(addr));
|
||||
addr.sun_family = AF_UNIX;
|
||||
strncpy(addr.sun_path, path, sizeof(addr.sun_path) - 1);
|
||||
strncpy(addr.sun_path, "protect_path", sizeof(addr.sun_path) - 1);
|
||||
|
||||
if (connect(sock, (struct sockaddr *)&addr, sizeof(addr)) == -1) {
|
||||
LOGE("[android] connect() failed: %s (socket fd = %d), path: %s\n",
|
||||
strerror(errno), sock, path);
|
||||
LOGE("[android] connect() failed for protect_path: %s (socket fd = %d)\n",
|
||||
strerror(errno), sock);
|
||||
close(sock);
|
||||
return -1;
|
||||
}
|
||||
@@ -115,16 +110,13 @@ send_traffic_stat(uint64_t tx, uint64_t rx)
|
||||
setsockopt(sock, SOL_SOCKET, SO_RCVTIMEO, (char *)&tv, sizeof(struct timeval));
|
||||
setsockopt(sock, SOL_SOCKET, SO_SNDTIMEO, (char *)&tv, sizeof(struct timeval));
|
||||
|
||||
char path[257];
|
||||
sprintf(path, "%s/stat_path", prefix);
|
||||
|
||||
memset(&addr, 0, sizeof(addr));
|
||||
addr.sun_family = AF_UNIX;
|
||||
strncpy(addr.sun_path, path, sizeof(addr.sun_path) - 1);
|
||||
strncpy(addr.sun_path, "stat_path", sizeof(addr.sun_path) - 1);
|
||||
|
||||
if (connect(sock, (struct sockaddr *)&addr, sizeof(addr)) == -1) {
|
||||
LOGE("[android] connect() failed: %s (socket fd = %d), path: %s\n",
|
||||
strerror(errno), sock, path);
|
||||
LOGE("[android] connect() failed for stat_path: %s (socket fd = %d): %s\n",
|
||||
strerror(errno), sock);
|
||||
close(sock);
|
||||
return -1;
|
||||
}
|
||||
|
||||
+1
-5
@@ -99,7 +99,6 @@ int vpn = 0;
|
||||
uint64_t tx = 0;
|
||||
uint64_t rx = 0;
|
||||
ev_tstamp last = 0;
|
||||
char *prefix;
|
||||
#endif
|
||||
|
||||
static int acl = 0;
|
||||
@@ -1221,7 +1220,7 @@ main(int argc, char **argv)
|
||||
USE_TTY();
|
||||
|
||||
#ifdef ANDROID
|
||||
while ((c = getopt_long(argc, argv, "f:s:p:l:k:t:m:i:c:b:a:n:P:huUvVA6",
|
||||
while ((c = getopt_long(argc, argv, "f:s:p:l:k:t:m:i:c:b:a:n:huUvVA6",
|
||||
long_options, &option_index)) != -1) {
|
||||
#else
|
||||
while ((c = getopt_long(argc, argv, "f:s:p:l:k:t:m:i:c:b:a:n:huUvA6",
|
||||
@@ -1313,9 +1312,6 @@ main(int argc, char **argv)
|
||||
case 'V':
|
||||
vpn = 1;
|
||||
break;
|
||||
case 'P':
|
||||
prefix = optarg;
|
||||
break;
|
||||
#endif
|
||||
case '?':
|
||||
// The option character is not recognized.
|
||||
|
||||
@@ -88,7 +88,6 @@ static void close_and_free_server(EV_P_ server_t *server);
|
||||
|
||||
#ifdef ANDROID
|
||||
int vpn = 0;
|
||||
char *prefix;
|
||||
#endif
|
||||
|
||||
int verbose = 0;
|
||||
@@ -876,9 +875,6 @@ main(int argc, char **argv)
|
||||
case 'V':
|
||||
vpn = 1;
|
||||
break;
|
||||
case 'P':
|
||||
prefix = optarg;
|
||||
break;
|
||||
#endif
|
||||
case '?':
|
||||
// The option character is not recognized.
|
||||
|
||||
Reference in New Issue
Block a user