void CMsnProto::p2p_clearDormantSessions(void) { mir_cslockfull lck(m_csSessions); time_t ts = time(NULL); for (int i = 0; i < m_arSessions.getCount(); i++) { filetransfer* FT = &m_arSessions[i]; if (!FT->p2p_sessionid && !MSN_GetUnconnectedThread(FT->p2p_dest, SERVER_P2P_DIRECT)) p2p_invite(FT->p2p_type, FT, NULL); else if (FT->p2p_waitack && (ts - FT->ts) > 120) { FT->bCanceled = true; p2p_sendCancel(FT); lck.unlock(); p2p_unregisterSession(FT); lck.lock(); i = 0; } } }
void CMsnProto::p2p_clearDormantSessions(void) { EnterCriticalSection(&sessionLock); time_t ts = time(NULL); for (int i=0; i < sessionList.getCount(); i++) { filetransfer* FT = &sessionList[i]; if (!FT->p2p_sessionid && !MSN_GetUnconnectedThread(FT->p2p_dest, SERVER_P2P_DIRECT)) p2p_invite(FT->p2p_type, FT, NULL); else if (FT->p2p_waitack && (ts - FT->ts) > 120) { FT->bCanceled = true; p2p_sendCancel(FT); LeaveCriticalSection(&sessionLock); p2p_unregisterSession(FT); EnterCriticalSection(&sessionLock); i = 0; } } LeaveCriticalSection(&sessionLock); }