26 #include <ktorrent_export.h>
27 #include <util/constants.h>
28 #include <interfaces/webseedinterface.h>
29 #include <interfaces/chunkdownloadinterface.h>
30 #include <diskio/piecedata.h>
31 #include <peer/connectionlimit.h>
41 class WebSeedChunkDownload;
58 bool inCurrentRange(Uint32 chunk)
const {
return chunk >= first_chunk && chunk <= last_chunk;}
109 static void setProxy(
const QString & host,bt::Uint16 port);
162 void redirected(
const QUrl &to_url);
172 class AutoDisabled {};
174 void fillRangeList(Uint32 chunk);
175 void handleData(
const QByteArray & data);
176 void chunkStarted(Uint32 chunk);
178 void connectToServer();
179 void continueCurChunk();
186 HttpConnection* conn;
187 QList<QByteArray> chunks;
191 Uint32 bytes_of_cur_chunk;
194 WebSeedChunkDownload* current;
195 Uint32 up_gid,down_gid;
196 QList<Range> range_queue;
198 PieceData::Ptr cur_piece;
200 ConnectionLimit::Token::Ptr token;
202 static QString proxy_host;
203 static Uint16 proxy_port;
204 static bool proxy_enabled;
213 void getStats(
Stats & s)
override;
219 Uint32 pieces_downloaded;
Uint32 failedAttempts() const
Get the number of failed attempts.
void chunkDownloadStarted(WebSeedChunkDownload *cd, Uint32 chunk)
static void setProxyEnabled(bool on)
void chunkDownloadFinished(WebSeedChunkDownload *cd, Uint32 chunk)
void download(Uint32 first, Uint32 last)
Keep track of a piece of the file.
Interface for a ChunkDownload.
static void setProxy(const QString &host, bt::Uint16 port)
void disable(const QString &reason)
Disable the webseed.
bool inCurrentRange(Uint32 chunk) const
Check if a chunk lies in the current range we are downloading.
void onExcluded(Uint32 from, Uint32 to)
Uint32 getDownloadRate() const override
Get the current download rate.
void setGroupIDs(Uint32 up, Uint32 down)
void chunkReady(Chunk *c)
void chunkDownloaded(Uint32 chunk)
bool busy() const
Is this webseed busy ?
void setEnabled(bool on) override
Disable or enable the webseed.
WebSeedChunkDownload * currentChunkDownload()
Get the current webseed download.