# HG changeset patch # User Dremov Kirill (Nokia-D-MSW/Tampere) # Date 1279207167 -10800 # Node ID c6b52d057a05201a126e3fa86bd9deb1b4700d80 # Parent a17829cb5e59e79dcba83a47430f553868150135 Revision: 201025 Kit: 2010127 diff -r a17829cb5e59 -r c6b52d057a05 nettools/conntest/Engine/SocketsEngine.cpp --- a/nettools/conntest/Engine/SocketsEngine.cpp Wed Mar 31 21:08:37 2010 +0300 +++ b/nettools/conntest/Engine/SocketsEngine.cpp Thu Jul 15 18:19:27 2010 +0300 @@ -547,6 +547,50 @@ User::Panic( KPanicConnTest, EConnTestHttpClientInitializationFailed ); } + /* + * In case roaming, socket needs to be restarted in following cases. + */ + + if ( iEngineStatus == EConnecting || + iEngineStatus == ELookingUp ) + { + // Cancel and then re-connect + DoCancel(); + ConnectL(); + } + else if ( iEngineStatus == EConnected ) + { + // Cancel write socket + iSocketsWrite->Cancel(); + + // Cancel read socket + TBool isSocketActive( EFalse ); + if ( iSocketsRead->IsActive() ) + { + iSocketsRead->Cancel(); + isSocketActive = ETrue; + } + + // Re-connect + ChangeStatus( EInterfaceUp ); + ConnectL(); + + // Start read socket again + if ( isSocketActive ) + { + Read(); + } + } + else if ( iEngineStatus == EListening ) + { + DoCancel(); + ListenL(); + } + else if ( iEngineStatus == EDisconnecting ) + { + DoCancel(); + } + iConsole.PrintNotify( text ); } diff -r a17829cb5e59 -r c6b52d057a05 nettools/conntest/probe/src/prt.cpp --- a/nettools/conntest/probe/src/prt.cpp Wed Mar 31 21:08:37 2010 +0300 +++ b/nettools/conntest/probe/src/prt.cpp Thu Jul 15 18:19:27 2010 +0300 @@ -307,18 +307,20 @@ const TInt KMicrosInASecond = 1000000; - //TUint32 micros = interval.Int64().Low(); - TUint32 micros = I64LOW(interval.Int64());//.Low(); x.Low() -> I64LOW(x) - TUint32 secs = micros / KMicrosInASecond; - micros -= (secs * KMicrosInASecond); + // To avoid possible overflow caused by microsecond accuracy (32 bits + // of microseconds is just a bit over an hour), use 64-bit variables + // in calculation of timestamp + TInt64 secs = interval.Int64() / KMicrosInASecond; // // Reuse the protocol and flags fields of // RMBufPktInfo to store the time-stamp // RMBufPktInfo* info = RMBufPacket::PeekInfoInChain(copy); - info->iProtocol = static_cast(secs); - info->iFlags = static_cast(micros); + // Just let the seconds overflow in case of timestamp is over the + // integer scope (nothing reasonable to do in this case anyway) + info->iProtocol = static_cast( secs ); + info->iFlags = static_cast( interval.Int64() - ( secs * KMicrosInASecond )); iQueue.Append(copy); iDumpCb.CallBack();