/** * Remove a socket from the list of sockets that have upload slots. * * If the socket has mistakenly been added several times to the list, this method * will return all of the entries for the socket. * * @param socket the address of the socket that should be removed from the list. If this socket * does not exist in the list, this method will do nothing. */ bool UploadBandwidthThrottler::RemoveFromStandardList(ThrottledFileSocket* socket) { bool returnValue; sendLocker.Lock(); returnValue = RemoveFromStandardListNoLock(socket); sendLocker.Unlock(); return returnValue; }
void UploadBandwidthThrottler::RemoveFromAllQueues(ThrottledFileSocket* socket) { wxMutexLocker lock( m_sendLocker ); if (m_doRun) { DoRemoveFromAllQueues(socket); // And remove it from upload slots RemoveFromStandardListNoLock(socket); } }
/** * Add a socket to the list of sockets that have upload slots. The main thread will * continously call send on these sockets, to give them chance to work off their queues. * The sockets are called in the order they exist in the list, so the top socket (index 0) * will be given a chance first to use bandwidth, and then the next socket (index 1) etc. * * It is possible to add a socket several times to the list without removing it inbetween, * but that should be avoided. * * @param index insert the socket at this place in the list. An index that is higher than the * current number of sockets in the list will mean that the socket should be inserted * last in the list. * * @param socket the address to the socket that should be added to the list. If the address is NULL, * this method will do nothing. */ void UploadBandwidthThrottler::AddToStandardList(uint32 index, ThrottledFileSocket* socket) { if ( socket ) { wxMutexLocker lock( m_sendLocker ); RemoveFromStandardListNoLock(socket); if (index > (uint32)m_StandardOrder_list.size()) { index = m_StandardOrder_list.size(); } m_StandardOrder_list.insert(m_StandardOrder_list.begin() + index, socket); } }
void UploadBandwidthThrottler::RemoveFromAllQueues(ThrottledFileSocket* socket) { // Get critical section sendLocker.Lock(); if(doRun) { RemoveFromAllQueues(socket, false); // And remove it from upload slots RemoveFromStandardListNoLock(socket); } // End critical section sendLocker.Unlock(); }
/** * Add a socket to the list of sockets that have upload slots. The main thread will * continously call send on these sockets, to give them chance to work off their queues. * The sockets are called in the order they exist in the list, so the top socket (index 0) * will be given a chance first to use bandwidth, and then the next socket (index 1) etc. * * It is possible to add a socket several times to the list without removing it inbetween, * but that should be avoided. * * @param index insert the socket at this place in the list. An index that is higher than the * current number of sockets in the list will mean that the socket should be inserted * last in the list. * * @param socket the address to the socket that should be added to the list. If the address is NULL, * this method will do nothing. */ void UploadBandwidthThrottler::AddToStandardList(uint32 index, ThrottledFileSocket* socket) { if(socket != NULL) { sendLocker.Lock(); RemoveFromStandardListNoLock(socket); if(index > (uint32)m_StandardOrder_list.GetSize()) { index = m_StandardOrder_list.GetSize(); } m_StandardOrder_list.InsertAt(index, socket); sendLocker.Unlock(); // } else { // if (thePrefs.GetVerbose()) // theApp.AddDebugLogLine(true,"Tried to add NULL socket to UploadBandwidthThrottler Standard list! Prevented."); } }
/** * Remove a socket from the list of sockets that have upload slots. * * If the socket has mistakenly been added several times to the list, this method * will return all of the entries for the socket. * * @param socket the address of the socket that should be removed from the list. If this socket * does not exist in the list, this method will do nothing. */ bool UploadBandwidthThrottler::RemoveFromStandardList(ThrottledFileSocket* socket) { wxMutexLocker lock( m_sendLocker ); return RemoveFromStandardListNoLock(socket); }