From b0f6dc43b4e7450320c76b034d04094a36883e00 Mon Sep 17 00:00:00 2001 From: Joseph Henry Date: Mon, 16 Nov 2015 19:53:59 -0800 Subject: Revised fd RX logic --- netcon/NetconEthernetTap.cpp | 35 ++++++++++++++++------------------- 1 file changed, 16 insertions(+), 19 deletions(-) (limited to 'netcon/NetconEthernetTap.cpp') diff --git a/netcon/NetconEthernetTap.cpp b/netcon/NetconEthernetTap.cpp index 568ad188..ae1604fb 100644 --- a/netcon/NetconEthernetTap.cpp +++ b/netcon/NetconEthernetTap.cpp @@ -50,10 +50,9 @@ #include "NetconUtilities.hpp" #include "Common.c" -#define APPLICATION_POLL_FREQ 20 +#define APPLICATION_POLL_FREQ 20 #define ZT_LWIP_TCP_TIMER_INTERVAL 5 -#define STATUS_TMR_INTERVAL 2000 // How often we check connection statuses -#define DEBUG_LEVEL 3 +#define STATUS_TMR_INTERVAL 3000 // How often we check connection statuses namespace ZeroTier { @@ -151,13 +150,10 @@ bool NetconEthernetTap::removeIp(const InetAddress &ip) std::vector::iterator i(std::find(_ips.begin(),_ips.end(),ip)); if (i == _ips.end()) return false; - _ips.erase(i); - if (ip.isV4()) { // TODO: dealloc from LWIP } - return true; } @@ -259,11 +255,6 @@ TcpConnection *NetconEthernetTap::getConnectionByTheirFD(PhySocket *sock, int fd void NetconEthernetTap::compact_dump() { /* - // - refresh(); - clear(); - gotoxy(0,0); - */ clearscreen(); gotoxy(0,0); @@ -286,6 +277,14 @@ void NetconEthernetTap::compact_dump() } } } + */ + for(size_t i=0; irpcSock) == _phy.getDescriptor(rpc_sockets[i])) + fprintf(stderr, "\t(%d) ----> (%d)\n\n", _phy.getDescriptor(tcp_connections[j]->dataSock), tcp_connections[j]->perceived_fd); + } + } } /* @@ -301,7 +300,7 @@ void NetconEthernetTap::dump() fprintf(stderr, "*** IF YOU SEE THIS, EMAIL THE DUMP TEXT TO joseph.henry@zerotier.com ***\n"); fprintf(stderr, " tcp_conns = %d, rpc_socks = %d\n", tcp_connections.size(), rpc_sockets.size()); - // TODO: Add logic to detect bad mapping conditions + // TODO: Add logic to detect bad mapping conditions for(size_t i=0; ipcb, _phy.getDescriptor(conn->dataSock)); - //lwipstack->_tcp_sent(conn->pcb, NULL); - //lwipstack->_tcp_recv(conn->pcb, NULL); - //lwipstack->_tcp_err(conn->pcb, NULL); - //lwipstack->_tcp_poll(conn->pcb, NULL, 0); + //lwipstack->_tcp_sent(conn->pcb, NULL); + //lwipstack->_tcp_recv(conn->pcb, NULL); + //lwipstack->_tcp_err(conn->pcb, NULL); + //lwipstack->_tcp_poll(conn->pcb, NULL, 0); //lwipstack->_tcp_arg(conn->pcb, NULL); if(lwipstack->_tcp_close(conn->pcb) != ERR_OK) { dwr(MSG_ERROR, " closeConnection(): Error while calling tcp_close()\n"); @@ -409,7 +408,6 @@ void NetconEthernetTap::closeAll() void NetconEthernetTap::threadMain() throw() { - //initscr(); //signal(SIGPIPE, SIG_IGN); uint64_t prev_tcp_time = 0; uint64_t prev_status_time = 0; @@ -436,7 +434,6 @@ void NetconEthernetTap::threadMain() fprintf(stderr, "- IP_TMR_INTERVAL = %d\n", IP_TMR_INTERVAL); */ - // Main timer loop while (_run) { uint64_t now = OSUtils::now(); @@ -449,7 +446,7 @@ void NetconEthernetTap::threadMain() // Connection prunning if (since_status >= STATUS_TMR_INTERVAL) { - //compact_dump(); + compact_dump(); prev_status_time = now; if(rpc_sockets.size() || tcp_connections.size()) { -- cgit v1.2.3