From b1de77be1eb5356cd2d059ab0fb89788324b04f6 Mon Sep 17 00:00:00 2001 From: M66B Date: Fri, 24 Jun 2016 16:28:50 +0200 Subject: [PATCH] Cleanup obsolete code Refs #431 --- app/src/main/jni/netguard/netguard.h | 2 -- app/src/main/jni/netguard/session.c | 16 +--------------- app/src/main/jni/netguard/util.c | 4 ---- 3 files changed, 1 insertion(+), 21 deletions(-) diff --git a/app/src/main/jni/netguard/netguard.h b/app/src/main/jni/netguard/netguard.h index a28850d1..4b88e095 100644 --- a/app/src/main/jni/netguard/netguard.h +++ b/app/src/main/jni/netguard/netguard.h @@ -413,8 +413,6 @@ int open_tcp_socket(const struct arguments *args, int32_t get_local_port(const int sock); -int is_valid_fd(const int fd); - int write_syn_ack(const struct arguments *args, struct tcp_session *cur); int write_ack(const struct arguments *args, struct tcp_session *cur); diff --git a/app/src/main/jni/netguard/session.c b/app/src/main/jni/netguard/session.c index d5c9582c..eefb4e18 100644 --- a/app/src/main/jni/netguard/session.c +++ b/app/src/main/jni/netguard/session.c @@ -126,7 +126,7 @@ void *handle_events(void *a) { while (!stopping) { log_android(ANDROID_LOG_DEBUG, "Loop thread %x", thread_id); - // Count/check sessions + // Count sessions int isessions = 0; int usessions = 0; int tsessions = 0; @@ -208,20 +208,6 @@ void *handle_events(void *a) { "epoll interrupted tun %d thread %x", args->tun, thread_id); continue; } - } else if (errno == EBADF) { - if (is_valid_fd(args->tun)) { - log_android(ANDROID_LOG_ERROR, "epoll error %d: %s", errno, strerror(errno)); - report_exit(args, "epoll error %d: %s", errno, strerror(errno)); - break; - } - else { - log_android(ANDROID_LOG_ERROR, - "tun socket %d epoll error %d: %s", - args->tun, errno, strerror(errno)); - report_exit(args, "tun socket %d epoll error %d: %s", - args->tun, errno, strerror(errno)); - break; - } } else { log_android(ANDROID_LOG_ERROR, "epoll tun %d thread %x error %d: %s", diff --git a/app/src/main/jni/netguard/util.c b/app/src/main/jni/netguard/util.c index 23c1ec28..5ce74120 100644 --- a/app/src/main/jni/netguard/util.c +++ b/app/src/main/jni/netguard/util.c @@ -152,7 +152,3 @@ int32_t get_local_port(const int sock) { return ntohs(sin.sin_port); } -int is_valid_fd(const int fd) { - return fcntl(fd, F_GETFL) != -1 || errno != EBADF; -} -