vpnengine/ikev1lib/src/ikev1receiver.cpp
branchRCL_3
changeset 12 68dc8923de26
parent 0 33413c0669b9
--- a/vpnengine/ikev1lib/src/ikev1receiver.cpp	Fri Feb 19 23:50:52 2010 +0200
+++ b/vpnengine/ikev1lib/src/ikev1receiver.cpp	Fri Mar 12 15:48:43 2010 +0200
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
@@ -82,10 +82,21 @@
 //
 void CIkev1Receiver::StartReceive()
     {
+    iReceiving = ETrue;
     DoReceive();
     }
 
 // ---------------------------------------------------------------------------
+// Cancels receive.
+// ---------------------------------------------------------------------------
+//
+void CIkev1Receiver::CancelReceive()
+    {
+    iReceiving = EFalse;
+    Cancel();
+    }
+
+// ---------------------------------------------------------------------------
 // From class CActive
 // Handles completion of receive. 
 // ---------------------------------------------------------------------------
@@ -112,13 +123,15 @@
         }
     else
         {
+        iReceiving = EFalse;
         iCallback.ReceiveError( iStatus.Int() );
         }
     
     delete iUdpData;
     iUdpData = NULL;
     
-    if ( iStatus.Int() == KErrNone )
+    if ( iReceiving &&
+         iStatus.Int() == KErrNone )
         {
         // Continue receiving.
         DoReceive();
@@ -145,6 +158,8 @@
 //
 TInt CIkev1Receiver::RunError( TInt aError )
     {
+    iReceiving = EFalse;
+    
     delete iUdpData;
     iUdpData = NULL;