mirror of
https://github.com/shadowsocks/shadowsocks-libev.git
synced 2026-10-31 06:23:52 +00:00
fix some issues
This commit is contained in:
+3
-3
@@ -182,14 +182,14 @@ int protect_socket(void (*protect_cb)(int ret, void *data), void *data, int fd)
|
||||
int remotefd;
|
||||
struct sockaddr_un addr;
|
||||
|
||||
// Setup
|
||||
setnonblocking(remotefd);
|
||||
|
||||
if ( (remotefd = socket(AF_UNIX, SOCK_STREAM, 0)) == -1) {
|
||||
LOGE("[android] socket() failed: %s (socket fd = %d)\n", strerror(errno), remotefd);
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Setup
|
||||
setnonblocking(remotefd);
|
||||
|
||||
memset(&addr, 0, sizeof(addr));
|
||||
addr.sun_family = AF_UNIX;
|
||||
strncpy(addr.sun_path, "/data/data/com.github.shadowsocks/protect_path", sizeof(addr.sun_path)-1);
|
||||
|
||||
+2
-2
@@ -209,11 +209,11 @@ static void protect_cb(int ret, void *data) {
|
||||
|
||||
if (ret == -1) {
|
||||
close_and_free_remote(EV_DEFAULT, remote);
|
||||
close_and_free_remote(EV_DEFAULT, server);
|
||||
close_and_free_server(EV_DEFAULT, server);
|
||||
return;
|
||||
}
|
||||
|
||||
server_recv_cb(EV_DEFAULT, server->recv_ctx, EV_CUSTOM);
|
||||
server_recv_cb(EV_DEFAULT, &server->recv_ctx->io, EV_CUSTOM);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
+1
-1
@@ -127,7 +127,7 @@ static void protect_cb(int ret, void *data) {
|
||||
struct protect_ctx *protect_ctx = (struct protect_ctx*)data;
|
||||
if (ret != -1) {
|
||||
int s = sendto(protect_ctx->remote_ctx->fd, protect_ctx->buf,
|
||||
protect_ctx->buf_len, 0, protect_ctx->addr, protect_ctx->addr_len);
|
||||
protect_ctx->buf_len, 0, &protect_ctx->addr, protect_ctx->addr_len);
|
||||
if (s == -1) {
|
||||
ERROR("[udp] sendto_remote");
|
||||
}
|
||||
|
||||
+1
-1
@@ -89,7 +89,7 @@ struct protect_ctx {
|
||||
struct sockaddr_storage addr;
|
||||
int addr_len;
|
||||
struct remote_ctx *remote_ctx;
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif // _UDPRELAY_H
|
||||
|
||||
Reference in New Issue
Block a user