Improve speed of category tab title updates
[amule.git] / src / UploadQueue.h
blob4e132ec56f20dc4cbe08dfa1e0e9d5cd4c1f300e
1 //
2 // This file is part of the aMule Project.
3 //
4 // Copyright (c) 2003-2008 aMule Team ( admin@amule.org / http://www.amule.org )
5 // Copyright (c) 2002-2008 Merkur ( devs@emule-project.net / http://www.emule-project.net )
6 //
7 // Any parts of this program derived from the xMule, lMule or eMule project,
8 // or contributed by third-party developers are copyrighted by their
9 // respective authors.
11 // This program is free software; you can redistribute it and/or modify
12 // it under the terms of the GNU General Public License as published by
13 // the Free Software Foundation; either version 2 of the License, or
14 // (at your option) any later version.
16 // This program is distributed in the hope that it will be useful,
17 // but WITHOUT ANY WARRANTY; without even the implied warranty of
18 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 // GNU General Public License for more details.
20 //
21 // You should have received a copy of the GNU General Public License
22 // along with this program; if not, write to the Free Software
23 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
26 #ifndef UPLOADQUEUE_H
27 #define UPLOADQUEUE_H
29 #include "ClientRef.h" // Needed for CClientRefList
30 #include "MD4Hash.h" // Needed for CMD4Hash
32 class CUpDownClient;
33 class CKnownFile;
35 class CUploadQueue
37 public:
38 CUploadQueue();
39 ~CUploadQueue();
40 void Process();
41 void AddClientToQueue(CUpDownClient* client);
42 bool RemoveFromUploadQueue(CUpDownClient* client);
43 bool RemoveFromWaitingQueue(CUpDownClient* client);
44 bool IsOnUploadQueue(const CUpDownClient* client) const;
45 bool IsDownloading(const CUpDownClient* client) const;
46 bool CheckForTimeOver(CUpDownClient* client);
47 void ResortQueue() { SortGetBestClient(true); }
49 const CClientRefList& GetWaitingList() const { return m_waitinglist; }
50 const CClientRefList& GetUploadingList() const { return m_uploadinglist; }
52 CUpDownClient* GetWaitingClientByIP_UDP(uint32 dwIP, uint16 nUDPPort, bool bIgnorePortOnUniqueIP, bool* pbMultipleIPs = NULL);
54 uint16 SuspendUpload(const CMD4Hash &, bool terminate);
55 void ResumeUpload(const CMD4Hash &);
56 CKnownFile* GetAllUploadingKnownFile() { return m_allUploadingKnownFile; }
58 private:
59 void RemoveFromWaitingQueue(CClientRefList::iterator pos);
60 uint16 GetMaxSlots() const;
61 void AddUpNextClient(CUpDownClient* directadd = 0);
62 bool IsSuspended(const CMD4Hash& hash) { return suspendedUploadsSet.find(hash) != suspendedUploadsSet.end(); }
63 CUpDownClient* SortGetBestClient(bool sortonly);
65 CClientRefList m_waitinglist;
66 CClientRefList m_uploadinglist;
68 std::set<CMD4Hash> suspendedUploadsSet; // set for suspended uploads
69 uint32 m_nLastStartUpload;
70 uint32 m_lastSort;
71 bool lastupslotHighID; // VQB lowID alternation
72 bool m_allowKicking;
73 // This KnownFile collects all currently uploading clients for display in the upload list control
74 CKnownFile * m_allUploadingKnownFile;
77 #endif // UPLOADQUEUE_H
78 // File_checked_for_headers