Little fix and cleanup

This commit is contained in:
angt
2015-11-21 19:09:21 +01:00
parent 9834498d94
commit 230c9fa26a

View File

@@ -773,7 +773,7 @@ int main (int argc, char **argv)
while (1) {
if (gt_close)
stop_loop = 1;
stop_loop |= 1;
if (stop_loop) {
if (((stop_loop&(1<<2)) || !buffer_read_size(&sock.write)) &&
@@ -799,6 +799,9 @@ int main (int argc, char **argv)
return 1;
}
FD_CLR(sock.fd, &wfds);
FD_CLR(tun.fd, &wfds);
#ifdef TCP_INFO
struct timeval now;
gettimeofday(&now, NULL);
@@ -848,9 +851,6 @@ int main (int argc, char **argv)
gt_encrypt(&ctx, &sock.write, &tun.read);
if (FD_ISSET(sock.fd, &wfds))
FD_CLR(sock.fd, &wfds);
if (buffer_read_size(&sock.write)) {
ssize_t r = fd_write(sock.fd, sock.write.read,
buffer_read_size(&sock.write));
@@ -889,9 +889,6 @@ int main (int argc, char **argv)
goto restart;
}
if (FD_ISSET(tun.fd, &wfds))
FD_CLR(tun.fd, &wfds);
while (1) {
size_t size = buffer_read_size(&tun.write);
ssize_t ip_size = ip_get_size(tun.write.read, size);