Fix restored columns getting an almost-zero width
[amule.git] / src / UploadQueue.h
blob6773d433659fa0dc15d4086fe9236dfa66b5a354
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 "MD4Hash.h" // Needed for CMD4Hash
30 #include <set>
32 class CUpDownClient;
34 class CUploadQueue
36 public:
37 CUploadQueue();
38 ~CUploadQueue();
39 void Process();
40 void AddClientToQueue(CUpDownClient* client);
41 bool RemoveFromUploadQueue(CUpDownClient* client);
42 bool RemoveFromWaitingQueue(CUpDownClient* client);
43 bool IsOnUploadQueue(const CUpDownClient* client) const;
44 bool IsDownloading(CUpDownClient* client) const;
45 bool CheckForTimeOver(CUpDownClient* client);
47 const CClientPtrList& GetWaitingList() const { return m_waitinglist; }
48 const CClientPtrList& GetUploadingList() const { return m_uploadinglist; }
50 CUpDownClient* GetWaitingClientByIP_UDP(uint32 dwIP, uint16 nUDPPort, bool bIgnorePortOnUniqueIP, bool* pbMultipleIPs = NULL);
52 uint16 SuspendUpload(const CMD4Hash &, bool terminate);
53 void ResumeUpload(const CMD4Hash &);
55 private:
56 void RemoveFromWaitingQueue(CClientPtrList::iterator pos);
57 uint16 GetMaxSlots() const;
58 void AddUpNextClient(CUpDownClient* directadd = 0);
59 bool IsSuspended(const CMD4Hash& hash) { return suspendedUploadsSet.find(hash) != suspendedUploadsSet.end(); }
60 CUpDownClient* SortGetBestClient(bool sortonly);
62 CClientPtrList m_waitinglist;
63 CClientPtrList m_uploadinglist;
65 std::set<CMD4Hash> suspendedUploadsSet; // set for suspended uploads
66 uint32 m_nLastStartUpload;
67 uint32 m_lastSort;
68 bool lastupslotHighID; // VQB lowID alternation
69 bool m_allowKicking;
72 #endif // UPLOADQUEUE_H
73 // File_checked_for_headers