mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-07 08:35:16 -04:00
fixed deadlock due to turtle calling addVirtualPeer for client services inside a mutex protected zone (breaks mutex order service > turtle)
This commit is contained in:
parent
dac885e24d
commit
2ab12a2ef5
1 changed files with 27 additions and 22 deletions
|
@ -1611,8 +1611,6 @@ void p3turtle::handleTunnelRequest(RsTurtleOpenTunnelItem *item)
|
|||
}
|
||||
|
||||
{
|
||||
RsStackMutex stack(mTurtleMtx); /********** STACK LOCKED MTX ******/
|
||||
|
||||
if(found)
|
||||
{
|
||||
#ifdef P3TURTLE_DEBUG
|
||||
|
@ -1621,9 +1619,13 @@ void p3turtle::handleTunnelRequest(RsTurtleOpenTunnelItem *item)
|
|||
// Send back tunnel ok to the same guy
|
||||
//
|
||||
RsTurtleTunnelOkItem *res_item = new RsTurtleTunnelOkItem ;
|
||||
TurtleVirtualPeerId vpid ;
|
||||
|
||||
res_item->request_id = item->request_id ;
|
||||
{
|
||||
RsStackMutex stack(mTurtleMtx); /********** STACK LOCKED MTX ******/
|
||||
res_item->tunnel_id = item->partial_tunnel_id ^ generatePersonalFilePrint(item->file_hash,_random_bias,false) ;
|
||||
|
||||
res_item->PeerId(item->PeerId()) ;
|
||||
|
||||
TurtleTunnelId t_id = res_item->tunnel_id ; // save it because sendItem deletes the item
|
||||
|
@ -1649,9 +1651,12 @@ void p3turtle::handleTunnelRequest(RsTurtleOpenTunnelItem *item)
|
|||
//
|
||||
_outgoing_tunnel_client_services[t_id] = service ;
|
||||
|
||||
vpid = _local_tunnels[t_id].vpid;
|
||||
}
|
||||
|
||||
// Notify the client service that there's a new virtual peer id available as a client.
|
||||
//
|
||||
service->addVirtualPeer(item->file_hash,_local_tunnels[t_id].vpid,RsTurtleGenericTunnelItem::DIRECTION_CLIENT) ;
|
||||
service->addVirtualPeer(item->file_hash,vpid,RsTurtleGenericTunnelItem::DIRECTION_CLIENT) ;
|
||||
|
||||
// We return straight, because when something is found, there's no need to digg a tunnel further.
|
||||
//
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue