mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-02-10 03:49:51 -05: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
@ -1611,8 +1611,6 @@ void p3turtle::handleTunnelRequest(RsTurtleOpenTunnelItem *item)
|
|||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
RsStackMutex stack(mTurtleMtx); /********** STACK LOCKED MTX ******/
|
|
||||||
|
|
||||||
if(found)
|
if(found)
|
||||||
{
|
{
|
||||||
#ifdef P3TURTLE_DEBUG
|
#ifdef P3TURTLE_DEBUG
|
||||||
@ -1621,9 +1619,13 @@ void p3turtle::handleTunnelRequest(RsTurtleOpenTunnelItem *item)
|
|||||||
// Send back tunnel ok to the same guy
|
// Send back tunnel ok to the same guy
|
||||||
//
|
//
|
||||||
RsTurtleTunnelOkItem *res_item = new RsTurtleTunnelOkItem ;
|
RsTurtleTunnelOkItem *res_item = new RsTurtleTunnelOkItem ;
|
||||||
|
TurtleVirtualPeerId vpid ;
|
||||||
|
|
||||||
res_item->request_id = item->request_id ;
|
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->tunnel_id = item->partial_tunnel_id ^ generatePersonalFilePrint(item->file_hash,_random_bias,false) ;
|
||||||
|
|
||||||
res_item->PeerId(item->PeerId()) ;
|
res_item->PeerId(item->PeerId()) ;
|
||||||
|
|
||||||
TurtleTunnelId t_id = res_item->tunnel_id ; // save it because sendItem deletes the item
|
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 ;
|
_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.
|
// 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.
|
// We return straight, because when something is found, there's no need to digg a tunnel further.
|
||||||
//
|
//
|
||||||
|
Loading…
x
Reference in New Issue
Block a user