email/imap4mtm/imapsession/src/cimapsessionmanager.cpp
changeset 55 5b3b2fa8c3ec
parent 0 72b543305e3a
child 60 7fdbb852d323
child 76 60a8a215b0ec
equal deleted inserted replaced
51:3507212d340e 55:5b3b2fa8c3ec
   139 	iDisconnectList.Reset();
   139 	iDisconnectList.Reset();
   140 	for (TInt session(0); session < aSessionList.Count(); ++session)
   140 	for (TInt session(0); session < aSessionList.Count(); ++session)
   141 		{
   141 		{
   142 		__LOG_TEXT(aSessionList[session]->LogId(), "CImapSessionManager::Disconnect (async, list)");
   142 		__LOG_TEXT(aSessionList[session]->LogId(), "CImapSessionManager::Disconnect (async, list)");
   143 
   143 
   144 		iDisconnectList.Append(aSessionList[session]);
   144 		TInt err = iDisconnectList.Append(aSessionList[session]);
       
   145 		if(err != KErrNone)
       
   146 			{
       
   147 			break;
       
   148 			}
   145 		}
   149 		}
   146 
   150 
   147 	iProgressState = TImap4GenericProgress::EDisconnecting;
   151 	iProgressState = TImap4GenericProgress::EDisconnecting;
   148 	DisconnectFirstSessionInList();
   152 	DisconnectFirstSessionInList();
   149 
   153 
   165 	iDisconnectList.Reset();
   169 	iDisconnectList.Reset();
   166 	for (TInt session(0); session < aSessionList.Count(); ++session)
   170 	for (TInt session(0); session < aSessionList.Count(); ++session)
   167 		{
   171 		{
   168 		__LOG_TEXT(aSessionList[session]->LogId(), "CImapSessionManager::Disconnect (sync, list)");
   172 		__LOG_TEXT(aSessionList[session]->LogId(), "CImapSessionManager::Disconnect (sync, list)");
   169 
   173 
   170 		iDisconnectList.Append(aSessionList[session]);
   174 		TInt err = iDisconnectList.Append(aSessionList[session]);
       
   175 		if(KErrNone != err)
       
   176             {
       
   177 		    CloseSessionStreams(aSessionList[session]);
       
   178             }
   171 		}
   179 		}
   172 
   180 
   173 	ImmediateDisconnect();
   181 	ImmediateDisconnect();
   174 	}
   182 	}
   175 
   183 
   185 
   193 
   186 	__LOG_TEXT(aSession.LogId(), "CImapSessionManager::Disconnect() - START - (sync, session)");
   194 	__LOG_TEXT(aSession.LogId(), "CImapSessionManager::Disconnect() - START - (sync, session)");
   187 
   195 
   188 	// Create a disconnect list with just this one session
   196 	// Create a disconnect list with just this one session
   189 	iDisconnectList.Reset();
   197 	iDisconnectList.Reset();
   190 	iDisconnectList.Append(&aSession);
   198 	TInt err = iDisconnectList.Append(&aSession);
       
   199 	
       
   200 	if(KErrNone != err)
       
   201         {
       
   202 	    // remove contness of aSession
       
   203 	    CImapSession& session = const_cast<CImapSession&>(aSession);
       
   204 	    MOutputStream* outputStream = session.OutputStream();    
       
   205         if (outputStream != NULL)
       
   206             {
       
   207             outputStream->Close();
       
   208             }
       
   209         }
       
   210 	
   191 	ImmediateDisconnect();
   211 	ImmediateDisconnect();
   192 
       
   193     __LOG_TEXT(aSession.LogId(), "CImapSessionManager::Disconnect() - END - (sync, session)");
   212     __LOG_TEXT(aSession.LogId(), "CImapSessionManager::Disconnect() - END - (sync, session)");
   194 	}
   213 	}
   195 
   214 
   196 /**
   215 /**
   197 Gets LastSocketActivityTimeout value for the connection
   216 Gets LastSocketActivityTimeout value for the connection