diff options
author | Joseph Henry <joseph.henry@zerotier.com> | 2015-10-14 16:04:26 -0400 |
---|---|---|
committer | Joseph Henry <joseph.henry@zerotier.com> | 2015-10-14 16:04:26 -0400 |
commit | 9ca699c86d520eb3bde5ba5b8884291298f0e8bd (patch) | |
tree | 5a0384a45966c62a758b31508af68c0fcafb5a10 | |
parent | d45db0f5af0ff7ede3b16a8f44d45e8dfedadb0a (diff) | |
download | infinitytier-9ca699c86d520eb3bde5ba5b8884291298f0e8bd.tar.gz infinitytier-9ca699c86d520eb3bde5ba5b8884291298f0e8bd.zip |
Added support for listen backlogs
-rw-r--r-- | ext/lwipopts.h | 2 | ||||
-rw-r--r-- | netcon/NetconEthernetTap.cpp | 10 |
2 files changed, 8 insertions, 4 deletions
diff --git a/ext/lwipopts.h b/ext/lwipopts.h index e7b78a8f..597fee50 100644 --- a/ext/lwipopts.h +++ b/ext/lwipopts.h @@ -48,6 +48,8 @@ //#define TCP_MSS 2048 //#define TCP_WND 512 +#define TCP_LISTEN_BACKLOG 1 + /*------------------------------------------------------------------------------ ---------------------------------- Timers -------------------------------------- ------------------------------------------------------------------------------*/ diff --git a/netcon/NetconEthernetTap.cpp b/netcon/NetconEthernetTap.cpp index 9aa9def0..8ca6d6ab 100644 --- a/netcon/NetconEthernetTap.cpp +++ b/netcon/NetconEthernetTap.cpp @@ -542,7 +542,6 @@ err_t NetconEthernetTap::nc_accept(void *arg, struct tcp_pcb *newpcb, err_t err) tap->tcp_connections.push_back(new_tcp_conn); int send_fd = tap->_phy.getDescriptor(conn->rpcSock); - int n = write(larg_fd, "z", 1); // accept() in library waits for this byte if(n > 0) { if(sock_fd_write(send_fd, fds[1]) > 0) { @@ -905,10 +904,14 @@ void NetconEthernetTap::handle_listen(PhySocket *sock, void **uptr, struct liste return; } - // TODO: Implement liste_with_backlog + struct tcp_pcb* listening_pcb; + if(listen_rpc->backlog > 0) + listening_pcb = lwipstack->tcp_listen_with_backlog(conn->pcb, listen_rpc->backlog); + else + listening_pcb = lwipstack->tcp_listen(conn->pcb); + // FIXME: Correct return values from this method, most is handled in intercept lib - struct tcp_pcb* listening_pcb = lwipstack->tcp_listen(conn->pcb); if(listening_pcb != NULL) { conn->pcb = listening_pcb; lwipstack->tcp_accept(listening_pcb, nc_accept); @@ -1092,7 +1095,6 @@ void NetconEthernetTap::handle_write(TcpConnection *conn) } if(conn->idx < max) { int sndbuf = conn->pcb->snd_buf; // How much we are currently allowed to write to the connection - /* PCB send buffer is full,turn off readability notifications for the corresponding PhySocket until nc_sent() is called and confirms that there is now space on the buffer */ |