networkcontrol/ipnetworklayer/src/IPProtoCprStates.cpp
changeset 18 39bb7c3571e9
parent 14 b33c3d136b7e
child 40 d566d76acea1
--- a/networkcontrol/ipnetworklayer/src/IPProtoCprStates.cpp	Fri Apr 16 16:36:59 2010 +0300
+++ b/networkcontrol/ipnetworklayer/src/IPProtoCprStates.cpp	Mon May 03 13:58:16 2010 +0300
@@ -221,6 +221,33 @@
     	}
 	}
 
+
+DEFINE_SMELEMENT(TAwaitingStop, NetStateMachine::MState, IpProtoCpr::TContext)
+TBool TAwaitingStop::Accept()
+    {
+	/*
+	Please note, in order for this to work, ESock needs to export the Accept function
+	of the CoreNetStates::TAwaitingStop.
+	*/
+	CoreNetStates::TAwaitingStop state(iContext);
+    if (state.Accept())
+        {
+		if (iContext.Node().CountActivities(ECFActivityDestroy) == 0)
+            {
+            return ETrue;
+            }
+		else
+            {
+            //The messageId is cleared so the CoreNetStates::TAwaitingStop is not picking up this TStop message after this Accept has rejected it.
+            //If this activity is kicked off while there is a Destroy activity, most probably the phone will crash, as there will be a SelfStop
+            //which will arrive after the node has destructed.
+            iContext.iMessage.ClearMessageId();
+            }
+        }
+    return EFalse;
+    }
+
+
 DEFINE_SMELEMENT(TAwaitingDataMonitoringNotification, NetStateMachine::MState, IpProtoCpr::TContext)
 TBool TAwaitingDataMonitoringNotification::Accept()
 	{