vpnengine/ikev1lib/src/ikev1receiver.cpp
branchRCL_3
changeset 12 68dc8923de26
parent 0 33413c0669b9
equal deleted inserted replaced
8:032d3a818f49 12:68dc8923de26
     1 /*
     1 /*
     2 * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
    80 // Starts receive.
    80 // Starts receive.
    81 // ---------------------------------------------------------------------------
    81 // ---------------------------------------------------------------------------
    82 //
    82 //
    83 void CIkev1Receiver::StartReceive()
    83 void CIkev1Receiver::StartReceive()
    84     {
    84     {
       
    85     iReceiving = ETrue;
    85     DoReceive();
    86     DoReceive();
       
    87     }
       
    88 
       
    89 // ---------------------------------------------------------------------------
       
    90 // Cancels receive.
       
    91 // ---------------------------------------------------------------------------
       
    92 //
       
    93 void CIkev1Receiver::CancelReceive()
       
    94     {
       
    95     iReceiving = EFalse;
       
    96     Cancel();
    86     }
    97     }
    87 
    98 
    88 // ---------------------------------------------------------------------------
    99 // ---------------------------------------------------------------------------
    89 // From class CActive
   100 // From class CActive
    90 // Handles completion of receive. 
   101 // Handles completion of receive. 
   110         
   121         
   111         iCallback.IkeMsgReceivedL( *ikeHdr, iSrcAddr, iLocalPort );                
   122         iCallback.IkeMsgReceivedL( *ikeHdr, iSrcAddr, iLocalPort );                
   112         }
   123         }
   113     else
   124     else
   114         {
   125         {
       
   126         iReceiving = EFalse;
   115         iCallback.ReceiveError( iStatus.Int() );
   127         iCallback.ReceiveError( iStatus.Int() );
   116         }
   128         }
   117     
   129     
   118     delete iUdpData;
   130     delete iUdpData;
   119     iUdpData = NULL;
   131     iUdpData = NULL;
   120     
   132     
   121     if ( iStatus.Int() == KErrNone )
   133     if ( iReceiving &&
       
   134          iStatus.Int() == KErrNone )
   122         {
   135         {
   123         // Continue receiving.
   136         // Continue receiving.
   124         DoReceive();
   137         DoReceive();
   125         }
   138         }
   126     }
   139     }
   143 // Handles cancellation of receive. 
   156 // Handles cancellation of receive. 
   144 // ---------------------------------------------------------------------------
   157 // ---------------------------------------------------------------------------
   145 //
   158 //
   146 TInt CIkev1Receiver::RunError( TInt aError )
   159 TInt CIkev1Receiver::RunError( TInt aError )
   147     {
   160     {
       
   161     iReceiving = EFalse;
       
   162     
   148     delete iUdpData;
   163     delete iUdpData;
   149     iUdpData = NULL;
   164     iUdpData = NULL;
   150     
   165     
   151     iCallback.ReceiveError( aError );
   166     iCallback.ReceiveError( aError );
   152     return KErrNone;
   167     return KErrNone;