diff --git a/assets/shadowsocks b/assets/shadowsocks index f702e780..44bfbca5 100755 Binary files a/assets/shadowsocks and b/assets/shadowsocks differ diff --git a/jni/shadowsocks/encrypt.c b/jni/shadowsocks/encrypt.c index 173e8d50..e31384c5 100755 --- a/jni/shadowsocks/encrypt.c +++ b/jni/shadowsocks/encrypt.c @@ -2,10 +2,7 @@ #include "android.h" #include - -typedef unsigned char uint8_t; -typedef unsigned int uint32_t; -typedef unsigned long long uint64_t; +#include static int random_compare(const void *_x, const void *_y) { uint32_t i = _i; @@ -150,9 +147,8 @@ int recv_decrypt(int sock, char *buf, int len, int flags) { void get_table(const char* key) { uint8_t *table = encrypt_table; - uint8_t *tmp_hash; - tmp_hash = MD5((const uint8_t*)key, strlen(key), NULL); - _a = *(uint64_t *)tmp_hash; + uint8_t *tmp_hash = MD5((const uint8_t*)key, strlen(key), NULL); + _a = htole64(*(uint64_t *)tmp_hash); uint32_t i; for(i = 0; i < 256; ++i) { diff --git a/jni/shadowsocks/local.c b/jni/shadowsocks/local.c index b708d9dd..d455b95a 100644 --- a/jni/shadowsocks/local.c +++ b/jni/shadowsocks/local.c @@ -508,7 +508,8 @@ static void accept_cb (EV_P_ ev_io *w, int revents) if (sockfd < 0) { perror("socket"); close(sockfd); - free_server(server); + close_and_free_server(EV_A_ server); + freeaddrinfo(res); continue; } setnonblocking(sockfd); @@ -630,7 +631,11 @@ int main (int argc, char **argv) setnonblocking(listenfd); struct listen_ctx listen_ctx; listen_ctx.fd = listenfd; - struct ev_loop *loop = EV_DEFAULT; + struct ev_loop *loop = ev_default_loop(EVBACKEND_EPOLL | EVFLAG_NOENV); + if (!loop) { + LOGE("no epoll found here, maybe it hides under your chair"); + return 1; + } ev_io_init (&listen_ctx.io, accept_cb, listenfd, EV_READ); ev_io_start (loop, &listen_ctx.io); ev_run (loop, 0); diff --git a/libs/armeabi/shadowsocks b/libs/armeabi/shadowsocks index f702e780..44bfbca5 100755 Binary files a/libs/armeabi/shadowsocks and b/libs/armeabi/shadowsocks differ