mtpfws/mtpfw/src/cmtpconnection.cpp
changeset 31 a26669f87b46
parent 29 3ae5cb0b4c02
child 37 d9d8313203af
equal deleted inserted replaced
29:3ae5cb0b4c02 31:a26669f87b46
    92     	{
    92     	{
    93     	delete link;
    93     	delete link;
    94     	}
    94     	}
    95     
    95     
    96     iSessions.ResetAndDestroy();
    96     iSessions.ResetAndDestroy();
       
    97     
       
    98     if (iTransportConnection != NULL)
       
    99         {
       
   100         iTransportConnection->Unbind(*this);
       
   101         }
       
   102     
    97     //close the property
   103     //close the property
    98     iProperty.Close();
   104     iProperty.Close();
    99     // delete the ‘name?property
   105     // delete the ‘name?property
   100     RProcess process;
   106     RProcess process;
   101     RProperty::Delete(process.SecureId(), EMTPConnStateKey);
   107     RProperty::Delete(process.SecureId(), EMTPConnStateKey);
   355         if (ActiveSessions() == 0 || currentState == EStateErrorShutdown)
   361         if (ActiveSessions() == 0 || currentState == EStateErrorShutdown)
   356             {
   362             {
   357             CompleteCloseConnection();
   363             CompleteCloseConnection();
   358             ret = ETrue;
   364             ret = ETrue;
   359             }
   365             }
   360         
   366           
   361         SetState(EStateShutdown);
   367         SetState(EStateShutdown);
   362         PublishConnState(EDisconnectedFromHost);   
   368         PublishConnState(EDisconnectedFromHost);   
   363         }
   369         }
   364     
   370     
   365     __FLOG(_L8("ConnectionSuspended - Exit"));
   371     __FLOG(_L8("ConnectionSuspended - Exit"));
   370     {
   376     {
   371     __FLOG(_L8("CompleteCloseConnection - Entry"));
   377     __FLOG(_L8("CompleteCloseConnection - Entry"));
   372     
   378     
   373     CloseAllSessions();
   379     CloseAllSessions();
   374     iSessions.Reset();
   380     iSessions.Reset();
   375 	if (iTransportConnection != NULL)
       
   376 		{
       
   377 		iTransportConnection->Unbind(*this);
       
   378 		}
       
   379     
   381     
   380     //notify ConnectionMgr and corresponding transports of completion of connection close
   382     //notify ConnectionMgr and corresponding transports of completion of connection close
   381     iSingletons.ConnectionMgr().ConnectionCloseComplete(iConnectionId);    
   383     iSingletons.ConnectionMgr().ConnectionCloseComplete(iConnectionId);    
   382     iSingletons.Close();
   384     iSingletons.Close();
   383 
   385 
   403         Create the null session object which owns the transaction state for 
   405         Create the null session object which owns the transaction state for 
   404         transaction occuring outside a session (i.e. with SessionID == 0x00000000)
   406         transaction occuring outside a session (i.e. with SessionID == 0x00000000)
   405         */
   407         */
   406         SessionOpenedL(KMTPSessionNone);            
   408         SessionOpenedL(KMTPSessionNone);            
   407         
   409         
       
   410         if (iTransportConnection != NULL)
       
   411             {
       
   412             iTransportConnection->Unbind(*this);
       
   413             }
   408         iTransportConnection = &aTransportConnection;
   414         iTransportConnection = &aTransportConnection;
   409         iTransportConnection->BindL(*this); 
   415         iTransportConnection->BindL(*this);
   410         SetState(EStateOpen); 
   416         SetState(EStateOpen); 
   411          
   417          
   412         }
   418         }
   413     
   419     
   414     __FLOG(_L8("ConnectionResumed - Exit"));
   420     __FLOG(_L8("ConnectionResumed - Exit"));
   705 CMTPConnection::CMTPConnection(TUint aConnectionId, MMTPTransportConnection& aTransportConnection) :
   711 CMTPConnection::CMTPConnection(TUint aConnectionId, MMTPTransportConnection& aTransportConnection) :
   706     iConnectionId(aConnectionId),
   712     iConnectionId(aConnectionId),
   707     iEventQ(_FOFF(CMTPEventLink, iLink)),
   713     iEventQ(_FOFF(CMTPEventLink, iLink)),
   708     iTransportConnection(&aTransportConnection)
   714     iTransportConnection(&aTransportConnection)
   709     {
   715     {
   710     
   716     iTransportConnection->BindL(*this);
   711     }
   717     }
   712     
   718     
   713 /**
   719 /**
   714 Second phase constructor.
   720 Second phase constructor.
   715 @leave One of the system wide error code, if a processing failure occurs.
   721 @leave One of the system wide error code, if a processing failure occurs.