networkcontrol/ipnetworklayer/src/ipprotodeftscpr.cpp
changeset 60 d69860d28da4
parent 51 78fceed50f62
child 69 955592283707
equal deleted inserted replaced
51:78fceed50f62 60:d69860d28da4
    33 using namespace Messages;
    33 using namespace Messages;
    34 using namespace ESock;
    34 using namespace ESock;
    35 using namespace IPProtoDeftSCpr;
    35 using namespace IPProtoDeftSCpr;
    36 using namespace MeshMachine;
    36 using namespace MeshMachine;
    37 
    37 
    38 //We reserve space for two preallocated activities that may start concurrently on the default SCPR
       
    39 //node: destroy and data client stop.
       
    40 static const TUint KDefaultMaxPreallocatedActivityCount = 2;
       
    41 static const TUint KMaxPreallocatedActivitySize = sizeof(MeshMachine::CNodeRetryParallelActivity) + sizeof(MeshMachine::APreallocatedOriginators<4>);
       
    42 static const TUint KIPProtoDeftSCPRPreallocatedActivityBufferSize = KDefaultMaxPreallocatedActivityCount * KMaxPreallocatedActivitySize;
       
    43 
       
    44 //-=========================================================
    38 //-=========================================================
    45 //
    39 //
    46 // Activities
    40 // Activities
    47 //
    41 //
    48 //-=========================================================
    42 //-=========================================================
    56 NODEACTIVITY_END()
    50 NODEACTIVITY_END()
    57 }
    51 }
    58 
    52 
    59 namespace IPProtoDeftSCprDataClientStopActivity
    53 namespace IPProtoDeftSCprDataClientStopActivity
    60 {
    54 {
    61 DECLARE_DEFINE_CUSTOM_NODEACTIVITY(ECFActivityStopDataClient, IPProtoDeftSCprStop, TCFDataClient::TStop, MeshMachine::CNodeRetryActivity::NewL)
    55 DECLARE_DEFINE_CUSTOM_NODEACTIVITY(ECFActivityStopDataClient, IPProtoDeftSCprStop, TCFDataClient::TStop, MeshMachine::CPreallocatedNodeRetryActivity::New)
    62     FIRST_NODEACTIVITY_ENTRY(CoreNetStates::TAwaitingDataClientStop, TNoTagOrProviderStoppedOrDaemonReleased)
    56     FIRST_NODEACTIVITY_ENTRY(CoreNetStates::TAwaitingDataClientStop, TNoTagOrProviderStoppedOrDaemonReleased)
    63     NODEACTIVITY_ENTRY(KNoTag, TStopNetCfgExt, TAwaitingStateChange, TDaemonReleasedStateChangedOrNoTag)
    57     NODEACTIVITY_ENTRY(KNoTag, TStopNetCfgExt, TAwaitingStateChange, TDaemonReleasedStateChangedOrNoTag)
    64     NODEACTIVITY_ENTRY(KNoTag, TForwardToControlProviderAndResetSentTo, TAwaitingStateChange, TDaemonReleasedStateChangedOrNoTagBackward)
    58     NODEACTIVITY_ENTRY(KNoTag, TForwardToControlProviderAndResetSentTo, TAwaitingStateChange, TDaemonReleasedStateChangedOrNoTagBackward)
    65     THROUGH_NODEACTIVITY_ENTRY(KDaemonReleasedStateChanged, TForwardToControlProviderAndResetSentTo,  TTag<KDaemonReleased>)
    59     THROUGH_NODEACTIVITY_ENTRY(KDaemonReleasedStateChanged, TForwardToControlProviderAndResetSentTo,  TTag<KDaemonReleased>)
    66     NODEACTIVITY_ENTRY(KDaemonReleased, SCprStates::TStopYourFlows, CoreNetStates::TAwaitingDataClientStopped,  MeshMachine::TTag<CoreNetStates::KProviderStopped>)
    60     NODEACTIVITY_ENTRY(KDaemonReleased, SCprStates::TStopYourFlows, CoreNetStates::TAwaitingDataClientStopped,  MeshMachine::TTag<CoreNetStates::KProviderStopped>)
   171     }
   165     }
   172 
   166 
   173 void CIPProtoDeftSubConnectionProvider::ConstructL()
   167 void CIPProtoDeftSubConnectionProvider::ConstructL()
   174     {
   168     {
   175     ADataMonitoringProvider::ConstructL();
   169     ADataMonitoringProvider::ConstructL();
   176     CCoreSubConnectionProvider::ConstructL(KIPProtoDeftSCPRPreallocatedActivityBufferSize);
   170     CCoreSubConnectionProvider::ConstructL();
   177     }
   171     }
   178 
   172 
   179 
   173 
   180 void CIPProtoDeftSubConnectionProvider::ReceivedL(const TRuntimeCtxId& aSender, const TNodeId& aRecipient, TSignatureBase& aMessage)
   174 void CIPProtoDeftSubConnectionProvider::ReceivedL(const TRuntimeCtxId& aSender, const TNodeId& aRecipient, TSignatureBase& aMessage)
   181 	{
   175 	{
   194     return prov;
   188     return prov;
   195     }
   189     }
   196 
   190 
   197 CIPProtoDeftSubConnectionProvider::~CIPProtoDeftSubConnectionProvider()
   191 CIPProtoDeftSubConnectionProvider::~CIPProtoDeftSubConnectionProvider()
   198     {
   192     {
       
   193     // In case network is not configured i.e. AP might get close in case for WIFi for an example, DHCP registration
       
   194     //will get failed. There is not point listening to such Progresses. So can notification and delete
       
   195     //delete CNetCfgExtNotify pointer).
   199    if(iNetworkConfigurationState == EFalse)
   196    if(iNetworkConfigurationState == EFalse)
   200        {
   197        {
   201        if(iNotify)
   198        if(iNotify)
   202            {
   199            {
   203            delete iNotify;
   200            delete iNotify;
   204            iNotify = NULL;
   201            iNotify = NULL;
   205            }
   202            }
   206        }
   203        }
   207 	if (iControl)
   204 	if (iControl)
   208 		delete iControl;
   205 		delete iControl;
       
   206 	//incase registration is successful and Network is configured. 
   209 	if (iNotify)
   207 	if (iNotify)
   210 	    {
   208 	    {
   211 		delete iNotify;
   209 		delete iNotify;
   212 		iNotify = NULL;
   210 		iNotify = NULL;
   213 		}
   211 		}