21 #ifndef BT_CONNECTIONLIMIT_H
22 #define BT_CONNECTIONLIMIT_H
25 #include <QSharedPointer>
26 #include <util/constants.h>
27 #include <util/sha1hash.h>
28 #include <ktorrent_export.h>
35 class KTORRENT_EXPORT ConnectionLimit
39 virtual ~ConnectionLimit();
42 bt::Uint32 totalConnections()
const {
return global_total;}
49 void setLimits(bt::Uint32 global_limit, bt::Uint32 torrent_limit);
58 Token(ConnectionLimit & limit,
const bt::SHA1Hash & hash);
64 typedef QSharedPointer<Token> Ptr;
67 ConnectionLimit & limit;
77 Token::Ptr acquire(
const SHA1Hash & hash);
84 void release(
const Token & token);
87 bt::Uint32 global_limit;
88 bt::Uint32 global_total;
89 bt::Uint32 torrent_limit;
90 QMap<SHA1Hash, bt::Uint32> torrent_totals;
95 #endif // BT_CONNECTIONLIMIT_H