aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar zfl9 <zfl9.com@gmail.com> 2020-03-07 12:34:40 +0800
committerGravatar zfl9 <zfl9.com@gmail.com> 2020-03-07 12:34:40 +0800
commit6c6c1607b421386195471e6c7a139e4dae599d1b (patch)
treea2816caec24567ba50fd4dc11d7de659c5e382b3
parentuse libev instead of libuv (diff)
downloaddns2tcp-6c6c1607b421386195471e6c7a139e4dae599d1b.tar.gz
dns2tcp-6c6c1607b421386195471e6c7a139e4dae599d1b.tar.bz2
dns2tcp-6c6c1607b421386195471e6c7a139e4dae599d1b.zip
use libev instead of libuv
-rw-r--r--dnsudp2tcp.c5
-rwxr-xr-xtestbin77424 -> 77424 bytes
2 files changed, 3 insertions, 2 deletions
diff --git a/dnsudp2tcp.c b/dnsudp2tcp.c
index 54811b5..9d46294 100644
--- a/dnsudp2tcp.c
+++ b/dnsudp2tcp.c
@@ -428,6 +428,7 @@ static void udp_recvmsg_cb(evloop_t *evloop, evio_t *watcher __attribute__((unus
}
if (skip_connect && tcpw->nrcvsnd >= nrecv) {
+ tcpw->nrcvsnd = 0; /* reset to zero for recv data */
ev_io_init((evio_t *)tcpw, tcp_recvmsg_cb, sockfd, EV_READ);
} else {
ev_io_init((evio_t *)tcpw, skip_connect ? tcp_sendmsg_cb : tcp_connect_cb, sockfd, EV_WRITE);
@@ -443,13 +444,13 @@ FREE_TCP_WATCHER:
static void tcp_connect_cb(evloop_t *evloop, evio_t *watcher, int events __attribute__((unused))) {
if (getsockopt(watcher->fd, SOL_SOCKET, SO_ERROR, &errno, &(socklen_t){sizeof(errno)}) < 0 || errno) {
- LOGERR("[tcp_connect_cb] connect to %s#%hu failed: (%d) %s", g_remote_ipstr, g_remote_portno, errno, strerror(errno));
+ LOGERR("[tcp_connect_cb] connect to %s#%hu: (%d) %s", g_remote_ipstr, g_remote_portno, errno, strerror(errno));
ev_io_stop(evloop, watcher);
close(watcher->fd);
free(watcher);
return;
}
- IF_VERBOSE LOGINF("[tcp_connect_cb] connect to %s#%hu success", g_remote_ipstr, g_remote_portno);
+ IF_VERBOSE LOGINF("[tcp_connect_cb] connected to %s#%hu", g_remote_ipstr, g_remote_portno);
ev_set_cb(watcher, tcp_sendmsg_cb);
ev_invoke(evloop, watcher, EV_WRITE);
}
diff --git a/test b/test
index d1cb362..8b2c217 100755
--- a/test
+++ b/test
Binary files differ