NS_IMETHODIMP nsMsgCopyService::NotifyCompletion(nsISupports* aSupport, nsIMsgFolder* dstFolder, nsresult result) { if (PR_LOG_TEST(gCopyServiceLog, PR_LOG_ALWAYS)) LogCopyCompletion(aSupport, dstFolder); nsCopyRequest* copyRequest = nullptr; uint32_t numOrigRequests = m_copyRequests.Length(); do { // loop for copy requests, because if we do a cross server folder copy, // we'll have a copy request for the folder copy, which will in turn // generate a copy request for the messages in the folder, which // will have the same src support. copyRequest = FindRequest(aSupport, dstFolder); if (copyRequest) { // ClearRequest can cause a new request to get added to m_copyRequests // with matching source and dest folders if the copy listener starts // a new copy. We want to ignore any such request here, because it wasn't // the one that was completed. So we keep track of how many original // requests there were. if (m_copyRequests.IndexOf(copyRequest) >= numOrigRequests) break; // check if this copy request is done by making sure all the // sources have been processed. int32_t sourceIndex, sourceCount; sourceCount = copyRequest->m_copySourceArray.Length(); for (sourceIndex = 0; sourceIndex < sourceCount;) { if (!(copyRequest->m_copySourceArray.ElementAt(sourceIndex))->m_processed) break; sourceIndex++; } // if all sources processed, mark the request as processed if (sourceIndex >= sourceCount) copyRequest->m_processed = true; // if this request is done, or failed, clear it. if (copyRequest->m_processed || NS_FAILED(result)) { ClearRequest(copyRequest, result); numOrigRequests--; } else break; } else break; } while (copyRequest); return DoNextCopy(); }
/* =================== ServerResponse =================== */ void CHudServers::ServerResponse( struct net_response_s *response ) { char *szresponse; request_t *p; server_t *browser; int len; char sz[ 32 ]; // Remove from active list p = FindRequest( response->context, m_pActiveList ); if ( p ) { static int first = 0; RemoveServerFromList( &m_pActiveList, p ); m_nActiveQueries--; if ( !first ) { gEngfuncs.Con_Printf( "recv first %f\n", gEngfuncs.GetClientTime() ); first = 1; } } if ( response->error != NET_SUCCESS ) return; switch ( response->type ) { case NETAPI_REQUEST_DETAILS: if ( response->response ) { szresponse = (char *)response->response; len = strlen( szresponse ) + 100 + 1; sprintf( sz, "%i", (int)( 1000.0 * response->ping ) ); browser = new server_t; browser->remote_address = response->remote_address; browser->info = new char[ len ]; browser->ping = (int)( 1000.0 * response->ping ); strcpy( browser->info, szresponse ); NET_API->SetValueForKey( browser->info, "address", gEngfuncs.pNetAPI->AdrToString( &response->remote_address ), len ); NET_API->SetValueForKey( browser->info, "ping", sz, len ); AddServer( &m_pServers, browser ); } break; default: break; } }