mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-04-25 08:27:39 +02:00
Fixed recursive lock problem in closeConnection
This commit is contained in:
parent
b263926ea6
commit
c25ceaf06b
2 changed files with 15 additions and 9 deletions
|
@ -145,6 +145,9 @@ public:
|
|||
void (*_netif_set_up)(NETIF_SET_UP_SIG);
|
||||
void (*_netif_poll)(NETIF_POLL_SIG);
|
||||
|
||||
|
||||
Mutex _lock;
|
||||
|
||||
LWIPStack(const char* path) :
|
||||
_libref(NULL)
|
||||
{
|
||||
|
|
|
@ -292,14 +292,14 @@ void NetconEthernetTap::closeAllClients()
|
|||
void NetconEthernetTap::closeConnection(NetconConnection *conn)
|
||||
{
|
||||
NetconClient *client = conn->owner;
|
||||
lwipstack->tcp_arg(conn->pcb, NULL);
|
||||
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_close(conn->pcb);
|
||||
lwipstack->_tcp_arg(conn->pcb, NULL);
|
||||
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_close(conn->pcb);
|
||||
_phy.close(conn->sock);
|
||||
lwipstack->tcp_close(conn->pcb);
|
||||
lwipstack->_tcp_close(conn->pcb);
|
||||
client->removeConnection(conn->sock);
|
||||
}
|
||||
|
||||
|
@ -308,8 +308,11 @@ void NetconEthernetTap::closeConnection(NetconConnection *conn)
|
|||
*/
|
||||
void NetconEthernetTap::closeClient(NetconClient *client)
|
||||
{
|
||||
closeConnection(client->rpc);
|
||||
closeConnection(client->unmapped_conn);
|
||||
{
|
||||
Mutex::Lock _l(lwipstack->_lock);
|
||||
closeConnection(client->rpc);
|
||||
closeConnection(client->unmapped_conn);
|
||||
}
|
||||
for(size_t i=0; i<client->connections.size(); i++)
|
||||
{
|
||||
close(_phy.getDescriptor(client->connections[i]->sock));
|
||||
|
|
Loading…
Add table
Reference in a new issue