From c87efec81bd693e76052e6d4a601c9146798f7da Mon Sep 17 00:00:00 2001 From: drbob Date: Sun, 1 Jun 2014 01:16:34 +0000 Subject: [PATCH] Fix for UDP relay deadlock... not tested git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7393 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- libretroshare/src/pqi/pqissl.cc | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/libretroshare/src/pqi/pqissl.cc b/libretroshare/src/pqi/pqissl.cc index 117636575..a425a7d04 100644 --- a/libretroshare/src/pqi/pqissl.cc +++ b/libretroshare/src/pqi/pqissl.cc @@ -569,11 +569,11 @@ int pqissl::Delay_Connection() { waiting = WAITING_DELAY; - /* set delay */ - if (mConnectDelay == 0) - { - return Initiate_Connection(); - } + /* we cannot just jump to Initiate_Connection, + * but must switch to WAITING_DELAY for at least one cycle. + * to avoid deadlock between threads.... + * ie. so the connection stuff is called from tick(), rather than connect() + */ /* set Connection TS. */ @@ -597,8 +597,7 @@ int pqissl::Delay_Connection() rslog(RSL_DEBUG_BASIC, pqisslzone, out); } #endif - - if (time(NULL) > mConnectTS) + if (time(NULL) >= mConnectTS) { return Initiate_Connection(); }