Revision: 201025 RCL_3
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Thu, 15 Jul 2010 18:19:27 +0300
branchRCL_3
changeset 14 c6b52d057a05
parent 9 a17829cb5e59
child 15 5296bfa7b0a7
Revision: 201025 Kit: 2010127
nettools/conntest/Engine/SocketsEngine.cpp
nettools/conntest/probe/src/prt.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 );
     }
 
--- 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<TInt>(secs);
-		info->iFlags = static_cast<TUint>(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<TInt>( secs );
+		info->iFlags = static_cast<TUint>( interval.Int64() - ( secs * KMicrosInASecond ));
 
 		iQueue.Append(copy);
 		iDumpCb.CallBack();