datacommsserver/esockserver/ssock/ss_connstates.cpp
changeset 1 21d2ab05f085
parent 0 dfb7c4ff071f
child 4 928ed51ddc43
--- a/datacommsserver/esockserver/ssock/ss_connstates.cpp	Thu Dec 17 09:22:25 2009 +0200
+++ b/datacommsserver/esockserver/ssock/ss_connstates.cpp	Thu Jan 07 13:34:53 2010 +0200
@@ -168,6 +168,7 @@
 		}
     else
         {
+		ac.iStartReceived = ETrue;
         ac.SetSelectionScope(TSelectionPrefs::EExplicitConnection);
         }
 	}
@@ -845,10 +846,18 @@
     // activity Id and so will never give a match. Here we ensure that our second IPC is matched and accepted.
     
     TCFInternalEsock::TSubSess* msg = message_cast<TCFInternalEsock::TSubSess>(&aContext.iMessage);
-    if (!msg || msg->iMessage.Function() != ECNStart)
+	if (!msg || (msg->iMessage.Function() != ECNStart && msg->iMessage.Function() != ECNSetStartPrefs))
         {
         return CNodeActivityBase::Next(aContext);
         }
+    else if (iStartReceived)
+        {
+        // ECNSetStartPrefs should only ever be seen as the IPC in the TSubSess kick off message
+        // ECNStart should only be seen once after an ECNSetStartPrefs or as the kick off message
+        PanicClient(ETwice);
+        aContext.iReturn = KErrInUse;
+        return ETrue;
+        }
     
     MESH_LOG((KESockConnectionTag, _L8("CStartAttachActivity::Next:\tAccepted ECNStart IPC after ECNSetStartPrefs")));
     TBool nextRet = ACore::Next(&aContext);
@@ -1440,8 +1449,12 @@
 DEFINE_SMELEMENT(AllInterfaceNotificationActivity::TSendErrorToConnection, NetStateMachine::MStateTransition, TContext)
 void AllInterfaceNotificationActivity::TSendErrorToConnection::DoL()
 	{
-	// Send a TError to the CConnection to complete the shutdown handshake.
-	RNodeInterface::OpenPostMessageClose(TNodeCtxId(iContext.ActivityId(), iContext.NodeId()), iContext.Node().iConnection.Id(), TEBase::TError(iContext.Activity()->KickOffMessageId(), KErrCancel).CRef());
+	iContext.Node().iConnection.iLegacyConnection.CompleteAllInterfaceNotificationL(iContext.Activity()->Error());
+
+	TEBase::TError msg(iContext.Activity()->KickOffMessageId(), iContext.Activity()->Error());
+	iContext.Activity()->PostToOriginators(msg);
+
+	iContext.Activity()->SetError(KErrNone);
 	}
 
 DEFINE_SMELEMENT(TNoTagOrCancelAllInterfaceWorker, NetStateMachine::MStateFork, TContext)