From 8734ee80921b276097a9dc7b488ac837686ce175 Mon Sep 17 00:00:00 2001 From: Volker Fischer Date: Mon, 7 Sep 2009 19:54:46 +0000 Subject: [PATCH] low channel time out value, fix for disconnect protocol message (we indeed require a counter, otherwise sending multiple disconnect messages would not work) --- src/channel.h | 2 +- src/protocol.cpp | 17 +++++++++++++---- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/channel.h b/src/channel.h index 9433ce87..615c3a2c 100755 --- a/src/channel.h +++ b/src/channel.h @@ -39,7 +39,7 @@ // Set the time-out for the input buffer until the state changes from // connected to not connected (the actual time depends on the way the error // correction is implemented) -#define CON_TIME_OUT_SEC_MAX 60 // seconds +#define CON_TIME_OUT_SEC_MAX 30 // seconds enum EPutDataStat { diff --git a/src/protocol.cpp b/src/protocol.cpp index a491dedc..ce0c62bb 100755 --- a/src/protocol.cpp +++ b/src/protocol.cpp @@ -917,11 +917,20 @@ bool CProtocol::EvaluateReqNetwTranspPropsMes ( const CVector& vecData void CProtocol::CreateAndImmSendDisconnectionMes() { CVector vecDisconMessage; + int iCurCounter; - // build complete message (special case, there is not actual data - // and we do not use the counter since this is the very last message - // of the connection, after that no message will be evaluated) - GenMessageFrame ( vecDisconMessage, 0, + Mutex.lock(); + { + // store current counter value + iCurCounter = iCounter; + + // increase counter (wraps around automatically) + iCounter++; + } + Mutex.unlock(); + + // build complete message + GenMessageFrame ( vecDisconMessage, iCurCounter, PROTMESSID_DISCONNECTION, CVector ( 0 ) ); // immediately send acknowledge message