mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-01-31 08:25:38 +00:00
Unload lwipstack->_libref upon exit
This commit is contained in:
parent
2f4628520b
commit
236e474553
@ -51,7 +51,7 @@
|
||||
|
||||
#define APPLICATION_POLL_FREQ 5
|
||||
#define ZT_LWIP_TCP_TIMER_INTERVAL 10
|
||||
#define STATUS_TMR_INTERVAL 500
|
||||
#define STATUS_TMR_INTERVAL 500 // How often we check connection statuses
|
||||
|
||||
|
||||
namespace ZeroTier {
|
||||
@ -293,7 +293,7 @@ void NetconEthernetTap::closeConnection(TcpConnection *conn)
|
||||
*/
|
||||
void NetconEthernetTap::closeClient(PhySocket *sock)
|
||||
{
|
||||
for(int i=0; i<rpc_sockets.size(); i++) {
|
||||
for(size_t i=0; i<rpc_sockets.size(); i++) {
|
||||
if(rpc_sockets[i] == sock){
|
||||
rpc_sockets.erase(rpc_sockets.begin() + i);
|
||||
break;
|
||||
@ -314,10 +314,11 @@ void NetconEthernetTap::closeAll()
|
||||
closeConnection(tcp_connections.front());
|
||||
}
|
||||
|
||||
#include <sys/resource.h>
|
||||
|
||||
void NetconEthernetTap::threadMain()
|
||||
throw()
|
||||
{
|
||||
fprintf(stderr, "_threadMain()\n");
|
||||
uint64_t prev_tcp_time = 0;
|
||||
uint64_t prev_status_time = 0;
|
||||
uint64_t prev_etharp_time = 0;
|
||||
@ -353,29 +354,25 @@ void NetconEthernetTap::threadMain()
|
||||
|
||||
if (since_status >= STATUS_TMR_INTERVAL) {
|
||||
prev_status_time = now;
|
||||
fprintf(stderr, "tcp_conns = %d, rpc_socks = %d\n", tcp_connections.size(), rpc_sockets.size());
|
||||
|
||||
/* Here we will periodically check the list of rpc_sockets for any which
|
||||
do not currently have any data connection associated with them. If they are
|
||||
unused, then we will try to read from them, if they fail, we can safely assumes
|
||||
that the client has closed their and we can close ours */
|
||||
|
||||
for(int i=0, associated = 0; i<rpc_sockets.size(); i++, associated = 0) {
|
||||
for(int j=0; j<tcp_connections.size(); j++) {
|
||||
if(tcp_connections[j]->rpcSock == rpc_sockets[i])
|
||||
associated++;
|
||||
}
|
||||
if(!associated){
|
||||
// No TCP connections are associated, this is a candidate for removal
|
||||
//fprintf(stderr, "removing RPC connection... \n");
|
||||
char c;
|
||||
if(read(_phy.getDescriptor(rpc_sockets[i]),&c,1) < 0) {
|
||||
closeClient(rpc_sockets[i]);
|
||||
if(rpc_sockets.size() || tcp_connections.size()) {
|
||||
/* Here we will periodically check the list of rpc_sockets for those that
|
||||
do not currently have any data connection associated with them. If they are
|
||||
unused, then we will try to read from them, if they fail, we can safely assume
|
||||
that the client has closed their end and we can close ours */
|
||||
for(size_t i=0, associated = 0; i<rpc_sockets.size(); i++, associated = 0) {
|
||||
for(size_t j=0; j<tcp_connections.size(); j++) {
|
||||
if(tcp_connections[j]->rpcSock == rpc_sockets[i])
|
||||
associated++;
|
||||
}
|
||||
else {
|
||||
//fprintf(stderr, "this appears to be in use.\n");
|
||||
if(!associated){
|
||||
// No TCP connections are associated, this is a candidate for removal
|
||||
char c;
|
||||
if(read(_phy.getDescriptor(rpc_sockets[i]),&c,1) < 0) {
|
||||
closeClient(rpc_sockets[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
fprintf(stderr, "tcp_conns = %d, rpc_socks = %d\n", tcp_connections.size(), rpc_sockets.size());
|
||||
}
|
||||
}
|
||||
if (since_tcp >= ZT_LWIP_TCP_TIMER_INTERVAL) {
|
||||
@ -393,7 +390,7 @@ void NetconEthernetTap::threadMain()
|
||||
_phy.poll((unsigned long)std::min(tcp_remaining,etharp_remaining));
|
||||
}
|
||||
closeAll();
|
||||
// TODO: cleanup -- destroy LWIP state, kill any clients, unload .so, etc.
|
||||
dlclose(lwipstack->_libref);
|
||||
}
|
||||
|
||||
void NetconEthernetTap::phyOnUnixClose(PhySocket *sock,void **uptr)
|
||||
|
@ -4,11 +4,11 @@ sshd [ WORKS as of 20151022] Long ~15-20s delay for client during connect
|
||||
ssh [ WORKS as of 20151022]
|
||||
sftp [ WORKS as of 20151022]
|
||||
curl [ WORKS as of 20151021] Sometimes "tcp_input: pcb->next != pcb (before cache)" is seen
|
||||
apache (debug mode) [ WORKS as of 2015xxxx]
|
||||
apache (debug mode) [ WORKS as of 20150810]
|
||||
apache (prefork MPM) [ WORKS as of 20151021]
|
||||
nginx [ WORKS as of 20151022]
|
||||
nodejs [ WORKS as of 20151021]
|
||||
java [ WORKS as of 2015xxxx]
|
||||
java [ WORKS as of 20151010]
|
||||
tomcat [ WORKS as of 2015xxxx]
|
||||
thttpd [ WORKS as of 2015xxxx]
|
||||
vsftpd [BROKEN as of 20151021] Server sends 500 when 220 is expected
|
||||
|
Loading…
x
Reference in New Issue
Block a user