Revision: 201011 RCL_3
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Wed, 31 Mar 2010 23:11:34 +0300
branchRCL_3
changeset 15 a15e6baef510
parent 13 e4ed1060deb1
child 16 9fc0ed567871
Revision: 201011 Kit: 201013
package_definition.xml
vpnc_plat/vpnapi/inc/vpnnotifierdefs.h
vpnclient_sis/stub_sis/group/stub_nokia_vpn_client_armv5.pkg
vpnengine/eventviewer/data/vpnlogmessages1.lms
vpnengine/ikesocket/inc/receiver.h
vpnengine/ikesocket/src/connobserver.cpp
vpnengine/ikesocket/src/receiver.cpp
vpnengine/kmdserver/src/connectionstarter.cpp
--- a/package_definition.xml	Mon Mar 15 12:44:44 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,167 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<SystemDefinition schema="3.0.0">
-  <package id="vpnclient" name="VPN Client" levels="engine ui api">
-    <collection id="vpnengine" name="VPN Engine" level="engine">
-    	<!-- too many components in this collection.
-    		Probably best to group the binaries together into larger components
-    		or maybe split the collection into more reasonable groups  -->
-      <component id="eventmediatorapi" filter="s60" name="Event Mediator API">
-        <unit bldFile="vpnengine/eventmediatorapi/group"/>
-      </component>
-      <component id="eventviewer" filter="s60" name="Event Viewer">
-        <unit bldFile="vpnengine/eventviewer/group"/>
-      </component>
-      <component id="vpnins" filter="s60" name="VPN Installer">
-        <unit bldFile="vpnengine/vpnins/group"/>
-      </component>
-      <component id="acuagenttransport" filter="s60" name="ACU Agent Transport">
-        <unit bldFile="vpnengine/acuagenttransport/group"/>
-      </component>
-      <component id="acupluginlib" filter="s60" name="ACU Plugin Library">
-        <unit bldFile="vpnengine/acupluginlib/group"/>
-      </component>
-      <component id="ikepolparser" filter="s60" name="IKE Policy Parser">
-        <unit bldFile="vpnengine/ikepolparser/group"/>
-      </component>
-      <component id="utlbase64" filter="s60" name="Base64 Utilities">
-        <unit bldFile="vpnengine/utlbase64/group"/>
-      </component>
-      <component id="utlcrypto" filter="s60" name="Crypto Utilities">
-        <unit bldFile="vpnengine/utlcrypto/group"/>
-      </component>
-      <component id="utlxml" filter="s60" name="XML Utilities">
-        <unit bldFile="vpnengine/utlxml/group"/>
-      </component>
-      <component id="utlpkcs10" filter="s60" name="PKCS#10 Utilities">
-        <unit bldFile="vpnengine/utlpkcs10/group"/>
-      </component>
-      <component id="pkiserviceapi" filter="s60" name="PKI Service API">
-        <unit bldFile="vpnengine/pkiserviceapi/group"/>
-      </component>
-      <component id="acuagentcrypto" filter="s60" name="ACU Agent Crypto">
-        <unit bldFile="vpnengine/acuagentcrypto/group"/>
-      </component>
-      <component id="vpnextapi" filter="s60" name="VPN Extension API">
-        <unit bldFile="vpnengine/vpnextapi/group"/>
-      </component>
-      <component id="ikecert" filter="s60" name="IKE Certificate Management">
-        <unit bldFile="vpnengine/ikecert/group"/>
-      </component>
-      <component id="kmdapi" filter="s60" name="Key Management Daemon API">
-        <unit bldFile="vpnengine/kmdapi/group"/>
-      </component>
-      <component id="kmdserver" filter="s60" name="Key Management Daemon Server">
-        <unit bldFile="vpnengine/kmdserver/group"/>
-      </component>
-      <component id="ikeutils" filter="s60" name="Internet Key Exchange Utils">
-        <unit bldFile="vpnengine/ikeutils/group"/>
-      </component>
-      <component id="ikev1lib" filter="s60" name="IKEv1 Library">
-        <unit bldFile="vpnengine/ikev1lib/group"/>
-      </component>
-      <component id="ikev2lib" filter="s60" name="IKEv2 Library">
-        <unit bldFile="vpnengine/ikev2lib/group"/>
-      </component>
-      <component id="acuagentmessage" filter="s60" name="ACU Agent Message">
-        <unit bldFile="vpnengine/acuagentmessage/group"/>
-      </component>
-      <component id="acuagent" filter="s60" name="Automatic Content Update Agent">
-        <unit bldFile="vpnengine/acuagent/group"/>
-      </component>
-      <component id="vpnawapi" filter="s60" name="VPN ACU Wrapper API">
-        <unit bldFile="vpnengine/vpnawapi/group"/>
-      </component>
-      <component id="vpnipsecpolparser" filter="s60" name="VPN IPsec Policy Parser">
-        <unit bldFile="vpnengine/vpnipsecpolparser/group"/>
-      </component>
-      <component id="sit" filter="s60" name="Socket Interaction Thread">
-        <unit bldFile="vpnengine/sit/group"/>
-      </component>
-      <component id="acuins" filter="s60" name="ACU Installer">
-        <unit bldFile="vpnengine/acuins/group"/>
-      </component>
-      <component id="vpntcwrapper" filter="s60" name="VPN Terminal Control Wrapper">
-        <unit bldFile="vpnengine/vpntcwrapper/group"/>
-      </component>
-      <component id="eventmediator" filter="s60" name="Event Mediator">
-        <unit bldFile="vpnengine/eventmediator/group"/>
-      </component>
-      <component id="ipsecacuplugin" filter="s60" name="IPsec ACU Plugin" class="plugin">
-        <unit bldFile="vpnengine/ipsecacuplugin/group"/>
-      </component>
-      <component id="pkiservice" filter="s60" name="PKI Service">
-        <unit bldFile="vpnengine/pkiservice/group"/>
-      </component>
-      <component id="vpnconnagt" filter="s60" name="VPN Connection Agent">
-        <unit bldFile="vpnengine/vpnconnagt/group"/>
-      </component>
-      <component id="vpnmanager" filter="s60" name="VPN Manager">
-        <unit bldFile="vpnengine/vpnmanager/group"/>
-      </component>
-      <component id="vpncleaner" filter="s60" name="VPN Cleaner">
-        <unit bldFile="vpnengine/vpncleaner/group"/>
-      </component>
-      <component id="utlpkcs12" filter="s60" name="PKCS#12 Utilities">
-        <unit bldFile="vpnengine/utlpkcs12/group"/>
-      </component>
-      <component id="dmadengine" filter="s60" name="DM Adapter Engine">
-        <unit bldFile="vpnengine/dmadengine/group"/>
-      </component>
-      <component id="dmadipsecvpn" filter="s60" name="IPsec VPN DM Adapter" class="plugin">
-        <unit bldFile="vpnengine/dmadipsecvpn/group"/>
-      </component>
-      <component id="dmadpki" filter="s60" name="PKI DM Adapter" class="plugin">
-        <unit bldFile="vpnengine/dmadpki/group"/>
-      </component>
-      <component id="ikesocketplugin" filter="s60" name="IKE Socket Plugin" class="plugin">
-        <unit bldFile="vpnengine/ikesocketplugin/group"/>
-      </component>
-      <component id="vpnnif" filter="s60" name="VPN NIF"/>
-    </collection>
-    <collection id="vpnui" name="VPN UI" level="ui">
-      <component id="vpnecomnotifier" filter="s60" name="VPN ECOM Notifier" class="plugin">
-        <unit bldFile="vpnui/vpnecomnotifier/group"/>
-      </component>
-      <component id="vpndialogmanager" filter="s60" name="VPN Dialog Manager">
-        <unit bldFile="vpnui/vpndialogmanager/group"/>
-      </component>
-      <component id="vpnmanagementui" filter="s60" name="VPN Management UI" class="plugin">
-        <unit bldFile="vpnui/vpnmanagementui/group"/>
-      </component>
-      <component id="vpnpolins" filter="s60" name="VPN Policy Installer">
-        <unit bldFile="vpnui/vpnpolins/group"/>
-      </component>
-      <component id="vpnpolicyrecognizer" filter="s60" name="VPN Policy Recognizer" class="plugin">
-        <unit bldFile="vpnui/vpnpolicyrecognizer/group"/>
-      </component>
-    </collection>
-    <collection id="vpnapiimpl" name="VPN API Implementation" level="api">
-      <component id="vpnapi" filter="s60" name="VPN API">
-        <unit bldFile="vpnapiimpl/group"/>
-      </component>
-    </collection>
-    <collection id="vpnclient_sis" name="VPN Client SIS" level="api">
-      <component id="ce_sis" filter="s60" name="CE SIS">
-        <unit bldFile="vpnclient_sis/ce_sis/group"/>
-      </component>
-      <component id="stub_sis" filter="s60" name="Stub SIS">
-        <unit bldFile="vpnclient_sis/stub_sis/group"/>
-      </component>
-      <component id="vpnclient_sis_build" filter="s60" name="VPN Client SIS Build">
-        <unit bldFile="vpnclient_sis/group"/>
-      </component>
-    </collection>
-    <collection id="vpnclient_info" name="VPN Client Info" level="api">
-      <component id="vpnclient_help" filter="s60" name="VPN Client Help">
-        <unit bldFile="help/group"/>
-      </component>
-      <component id="vpnclient_build" filter="s60" name="VPN Client Build">
-      	<!-- should split this up into the other components-->
-        <unit bldFile="group"/>
-      </component>
-      <component id="vpnc_plat" filter="s60" class="api" name="VPN Client Platform Interfaces">
-        <unit bldFile="vpnc_plat/vpnapi/group"/>
-      </component>
-    </collection>
-  </package>
-</SystemDefinition>
--- a/vpnc_plat/vpnapi/inc/vpnnotifierdefs.h	Mon Mar 15 12:44:44 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,184 +0,0 @@
-/*
-* Copyright (c) 2003-2006 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"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  VPN notifier definitions
-*
-*/
-
-
-#ifndef __VPNNOTIFIERDEFS_H__
-#define __VPNNOTIFIERDEFS_H__
-
-/**
- @file
- @released
- @publishedPartner
- 
- VPN Notifier definitions
-*/
-class TNoteDialog
-    {
-public:
-    enum TDialogId
-        {
-        EInfo = -10,
-        EWarning,
-        EError
-        };
-    };
-
-class TVpnDialogInfo
-    {
-public:
-    TVpnDialogInfo()
-        {
-        iDialogId = 0;
-        iNoteDialogId = 0;
-        }
-
-    TVpnDialogInfo(TInt aDialogId, TInt aNoteDialogId)
-        {
-        iDialogId = aDialogId;
-        iNoteDialogId = aNoteDialogId;
-        }
-
-    TInt DialogId() {return iDialogId;}
-    TInt NoteDialogId() {return iNoteDialogId;}
-
-private:
-    TInt iDialogId;
-    TInt iNoteDialogId;
-    };
-
-class TVpnDialogOutput
-    {
-public:
-    TVpnDialogOutput()
-        {
-        Clear();
-        }
-    void Clear()
-        {
-        iOutBuf.SetLength(0);
-        iOutBuf2.SetLength(0);
-        iOutInt = 0;
-        iOutInt2 = 0;
-        }
-
-public:
-    TBuf<256> iOutBuf;
-    TBuf<64> iOutBuf2;
-    TInt iOutInt;
-    TInt iOutInt2;
-    };
-
-// typedefs for backward compatibility
-// typedef new_type old_type
-typedef TVpnDialogInfo TIPSecDialogInfo;
-typedef TVpnDialogOutput TIPSecDialogOutput;
-
-
-// 
-// KMD notifier definitions
-//
-const TUid KUidKmdDialogNotifier = {0x101F513F};
-
-_LIT(KKmdNotifierResource, "\\resource\\KMDNOTIFIER.RSC");
-
-class TKmdDialog
-    {
-public:
-    enum TDialogId
-        {
-        EUserPwd = 1, // MUST be greater than the last value in enum TNoteDialog::TDialogId
-        ESecurIdPin,
-        ESecurIdNextPin,
-        EChallengeResponse,
-        EUsername
-        };
-    //added here for backward compatibility
-    enum TDialogId_OLD_STYLE
-        {
-        //EUserPwd = 1, // MUST be greater than the last value in enum TNoteDialog::TDialogId
-        ESecurIDPIN = 2,
-        ESecurIDNextPIN
-        };
-    };
-
-class TKmdNoteDialog
-    {
-public:
-    enum TTextId
-        {
-        ELamTypeNotSupported = 1,
-        EAuthenticationFailed,
-        ECryptoLibraryTooWeak
-        };
-    //added here for backward compatibility
-    enum TTextId_OLD_STYLE
-        {
-        ELAMTypeNotSupported = 1//,
-        //EAuthenticationFailed,
-        //ECryptoLibraryTooWeak
-        };
-    };
-
-// typedefs for backward compatibility
-// typedef existing_type old_type
-typedef TKmdDialog TKMDDialog;
-
-typedef TKmdNoteDialog TKMDNoteDialog;
-
-// 
-// PKI notifier definitions
-//
-_LIT(KPkiNotifierResource,"\\resource\\PKINOTIFIER.RSC");
-
-const TUid KUidPkiDialogNotifier = {0x101FAE08};
-
-class TPkiDialog
-    {
-public:
-    enum TDialogId
-        {
-        EEnterPwd = 1, // MUST be greater than the last value in enum TNoteDialog::TDialogId (vpnnotifierdefs.h)
-        EChangeActivePwd,
-        EInstallVpnPwd,
-        ECurrentVpnPwd,
-        EChangePwd,
-        EDefinePwd,
-        EEnterImportPwd
-        };
-    };
-
-class TPkiNoteDialog
-    {
-public:
-    enum TTextId
-        {
-        EWrongSecurityPwdNote = 1,
-        EWrongActivatePwdNote,
-        EActivatePwdErrorNote,
-        EPwdConfirmationNote,
-        ECryptoLibraryTooWeak,
-        EPwdTooShort,
-        EPwdEmpty
-        };
-    };
-
-// typedefs for backward compatibility
-// typedef new_type old_type
-typedef TPkiDialog TIPSecDialog;
-typedef TPkiNoteDialog TIPSecNoteDialog; // this was only used in pkinotifier (ipsecnotifier)
-
-#endif  // __VPNNOTIFIERDEFS_H__
--- a/vpnclient_sis/stub_sis/group/stub_nokia_vpn_client_armv5.pkg	Mon Mar 15 12:44:44 2010 +0200
+++ b/vpnclient_sis/stub_sis/group/stub_nokia_vpn_client_armv5.pkg	Wed Mar 31 23:11:34 2010 +0300
@@ -1,5 +1,5 @@
 ;
-; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+; Copyright (c) 2006-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"
@@ -11,25 +11,8 @@
 ;
 ; Contributors:
 ;
-; Description: 
-;
-
-; ============================================================================
-;  Name        : stub_nokia_vpn_client_armv5.pkg
-;  Part of     : VPN / VPN
-;  Description : Nokia VPN Client G1 S60 PACKAGE for Stub-SIS
-;  Version     : %version: %
+; Description: vpnclient package file for stub SIS
 ;
-;  Copyright © 2006 - 2008 Nokia.  All rights reserved.
-;  This material, including documentation and any related computer
-;  programs, is protected by copyright controlled by Nokia.  All
-;  rights are reserved.  Copying, including reproducing, storing,
-;  adapting or translating, any or all of this material requires the
-;  prior written consent of Nokia.  This material also contains
-;  confidential information which may not be disclosed to others
-;  without the prior written consent of Nokia.
-; ============================================================================
-;  Template version: 4.1
 
 ; LANGUAGES
 ; - None (English only by default)
--- a/vpnengine/eventviewer/data/vpnlogmessages1.lms	Mon Mar 15 12:44:44 2010 +0200
+++ b/vpnengine/eventviewer/data/vpnlogmessages1.lms	Wed Mar 31 23:11:34 2010 +0300
@@ -1,21 +1,22 @@
 /*
-* ==============================================================================
-*  Name        : vpnlogmessages1.lms
-*  Part of     : eventviewer
-*  Description : This is a localisation file for IPSec VPN software log messages.
-*  Version     : %version: 3 %
+* Copyright (c) 2003-2008 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"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
 *
-*  Copyright © 2003-2008 Nokia.  All rights reserved.
-*  This material, including documentation and any related computer
-*  programs, is protected by copyright controlled by Nokia.  All
-*  rights are reserved.  Copying, including reproducing, storing,
-*  adapting or translating, any or all of this material requires the
-*  prior written consent of Nokia.  This material also contains
-*  confidential information which may not be disclosed to others
-*  without the prior written consent of Nokia.
-* ============================================================================
-* Template version: 4.1
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
 *
+* Description: VPN log messages
+*
+*/
+
+
+/*
 * Syntax of a logical name entry in this file is the following:
 *
 * // d:context description (line 1)
@@ -44,6 +45,7 @@
 * ==============================================================================
 */
 
+
 // LOCALISATION STRINGS
 
 // **VPN LOG MESSAGES
--- a/vpnengine/ikesocket/inc/receiver.h	Mon Mar 15 12:44:44 2010 +0200
+++ b/vpnengine/ikesocket/inc/receiver.h	Wed Mar 31 23:11:34 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2008 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"
@@ -68,7 +68,7 @@
  *  
  *  @lib ikesocket.lib
  */
-NONSHARABLE_CLASS( CReceiver ) : private CActive
+NONSHARABLE_CLASS( CReceiver ) : private CTimer
     {
 public:
     /**
@@ -113,9 +113,10 @@
 
     enum TReceiverState
         {
-        EIdle,          // Idle
-        EWaitingData,   // Waiting data to become available for reading
-        EReceiving      // Receiving data
+        EIdle,                   // Idle
+        EWaitingData,            // Waiting data to become available for reading
+        EReceiving,              // Receiving data
+        EWaitingAfterSocketError // Waiting after socket error 
         };    
 
     CReceiver( RSocket& aSocket,
@@ -141,8 +142,11 @@
     
     /**
      * Handles error in receiving.
+     * @param aStatus Error status
+     * @param aSocket Informs if delay needed
      */
-    void HandleError( const TInt aStatus );
+    void HandleError( const TInt aStatus,
+                      const TBool aDelayNeeded = EFalse );
     
     /**
      * Notifies client that data has been received.
@@ -180,7 +184,13 @@
      * Own.
      */
     TReceiverState      iState;
-        
+       
+    /**
+     * Maximum error count.
+     * Own.
+     */
+    TInt                iErrorCount;
+    
     /**
      * Message data.
      * Own.
--- a/vpnengine/ikesocket/src/connobserver.cpp	Mon Mar 15 12:44:44 2010 +0200
+++ b/vpnengine/ikesocket/src/connobserver.cpp	Wed Mar 31 23:11:34 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2008 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"
@@ -83,7 +83,7 @@
 CConnObserver::CConnObserver( RConnection& aConnection,
                               MConnObserverCallback& aCallback,
                               MIkeDebug& aDebug ) 
- :CActive(EPriorityStandard),
+ :CActive( EPriorityStandard ),
  iConnection( aConnection ),
  iCallback( aCallback ),
  iDebug( aDebug )
@@ -107,8 +107,15 @@
 //
 void CConnObserver::RunL()
     {
-    DEBUG_LOG1( _L("CConnObserver::RunL(), iStatus=%d"), iStatus.Int() );    
-    iCallback.LinkDisconnected( iStatus.Int() );
+    DEBUG_LOG2( _L("CConnObserver::RunL(), iStatus=%d, error=%d"),
+            iStatus.Int(), iProgressBuf().iError );
+    TInt status = iStatus.Int();
+    if ( status == KErrNone )
+        {
+        status = iProgressBuf().iError;
+        }
+    
+    iCallback.LinkDisconnected( status );
     }
 
 // ---------------------------------------------------------------------------
--- a/vpnengine/ikesocket/src/receiver.cpp	Mon Mar 15 12:44:44 2010 +0200
+++ b/vpnengine/ikesocket/src/receiver.cpp	Wed Mar 31 23:11:34 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2008 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"
@@ -65,7 +65,7 @@
 CReceiver::CReceiver( RSocket& aSocket,
                       MReceiverCallback& aCallback,
                       MIkeDebug& aDebug )
- : CActive( EPriorityStandard ),
+ : CTimer( EPriorityStandard ),
    iState( EIdle ),
    iMsgPtr( 0, 0, 0 ),
    iSocket( aSocket ),
@@ -82,6 +82,7 @@
 void CReceiver::ConstructL()
     {
     DEBUG_LOG( _L("CReceiver::ConstructL") );
+    CTimer::ConstructL();
     }
 
 // ---------------------------------------------------------------------------
@@ -244,25 +245,38 @@
 // Handles error in receiving.
 // ---------------------------------------------------------------------------
 //
-void CReceiver::HandleError( const TInt aStatus )
+void CReceiver::HandleError( const TInt aStatus,
+                             const TBool aDelayNeeded )
     {
-    DEBUG_LOG1( _L("CReceiver::HandleError, aStatus=%d"), aStatus );
+    DEBUG_LOG3( _L("CReceiver::HandleError, aStatus=%d, error count=%d, delay needed=%d"),
+            aStatus, iErrorCount, aDelayNeeded );    
     
     delete iMsg;
     iMsg = NULL;
     iMsgPtr.Set( 0, 0, 0 );
-    iState = EIdle;
+    
+    const TInt KMaxReceiverErrorCount( 20 );
     
     if ( aStatus == KErrDied ||
          aStatus == KErrServerTerminated ||
-         aStatus == KErrNoMemory )
+         aStatus == KErrNoMemory ||
+         iErrorCount >= KMaxReceiverErrorCount )
         {
-        // Fatal error. Notify client.
+        // Fatal error or maximum error count reached. Notify client.
+        iState = EIdle;
         iCallback.ReceiveError( aStatus );
         }
+    else if ( aDelayNeeded )
+        {
+        // Restart receiving after delay.
+        iState = EWaitingAfterSocketError;
+        const TInt KDelayIntervalSocketError( 1000000 ); // 1s        
+        After( iErrorCount*KDelayIntervalSocketError );                
+        }
     else
         {
-        // Error is not fatal. Restart receiving
+        // Receiving can be continued without delay.
+        iState = EIdle;
         Receive();
         }
     }
@@ -308,13 +322,15 @@
 void CReceiver::RunL()
     {
     IKESOCKET_ASSERT( iState == EWaitingData ||
-                      iState == EReceiving );
+                      iState == EReceiving  ||
+                      iState == EWaitingAfterSocketError );
     DEBUG_LOG2( _L("CReceiver::RunL, iState=%d, iStatus=%d"),
             iState, iStatus.Int() );    
     
     if ( iStatus.Int() )
         {
-        HandleError( iStatus.Int() );
+        HandleError( iStatus.Int(), ETrue );
+        iErrorCount++;
         return;
         }
     
@@ -327,9 +343,16 @@
             }
         case EReceiving:
             {
+            iErrorCount = 0;
             HandleDataReceivedL();
             break;
             }
+        case EWaitingAfterSocketError:
+            {
+            iState = EIdle;
+            Receive();
+            break;
+            }
         default:
             break;
         }
@@ -343,10 +366,13 @@
 void CReceiver::DoCancel()
     {
     IKESOCKET_ASSERT( iState == EWaitingData ||
-            iState == EReceiving );
+                      iState == EReceiving ||
+                      iState == EWaitingAfterSocketError );
     DEBUG_LOG1( _L("CReceiver::DoCancel, iState=%d"),
             iState );
 
+    iErrorCount = 0;
+    
     switch ( iState )
         {
         case EWaitingData:
@@ -359,6 +385,11 @@
             iSocket.CancelRecv();
             break;
             }
+        case EWaitingAfterSocketError:
+            {
+            CTimer::DoCancel();
+            break;
+            }
         default:
             break;
         }
--- a/vpnengine/kmdserver/src/connectionstarter.cpp	Mon Mar 15 12:44:44 2010 +0200
+++ b/vpnengine/kmdserver/src/connectionstarter.cpp	Wed Mar 31 23:11:34 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2008 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"
@@ -51,7 +51,7 @@
 //
 CConnectionStarter::CConnectionStarter( CVpnConnection& aConnection,
                                         MConnectionStarterCallback& aCallback )
- : CActive( EPriorityStandard ),
+ : CActive( EPriorityHigh ), // Higher priority than in CDisconnectionObserver
    iConnection( aConnection ),
    iCallback( aCallback )
     {