libktorrent
2.2.0
src
net
uploadthread.h
1
/***************************************************************************
2
* Copyright (C) 2005 by Joris Guisson *
3
* joris.guisson@gmail.com *
4
* *
5
* This program is free software; you can redistribute it and/or modify *
6
* it under the terms of the GNU General Public License as published by *
7
* the Free Software Foundation; either version 2 of the License, or *
8
* (at your option) any later version. *
9
* *
10
* This program is distributed in the hope that it will be useful, *
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13
* GNU General Public License for more details. *
14
* *
15
* You should have received a copy of the GNU General Public License *
16
* along with this program; if not, write to the *
17
* Free Software Foundation, Inc., *
18
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
19
***************************************************************************/
20
#ifndef NETUPLOADTHREAD_H
21
#define NETUPLOADTHREAD_H
22
23
#include <qwaitcondition.h>
24
#include <qmutex.h>
25
#include <net/networkthread.h>
26
#include <net/wakeuppipe.h>
27
28
29
namespace
net
30
{
31
class
SocketMonitor;
32
36
class
UploadThread
:
public
NetworkThread
37
{
38
static
bt::Uint32 ucap;
39
static
bt::Uint32 sleep_time;
40
41
WakeUpPipe::Ptr wake_up;
42
public
:
43
UploadThread
(
SocketMonitor
* sm);
44
~
UploadThread
()
override
;
45
47
void
signalDataReady
();
48
50
static
void
setCap
(bt::Uint32 uc) {ucap = uc;}
51
53
static
Uint32
cap
() {
return
ucap;}
54
56
static
void
setSleepTime
(bt::Uint32 stime);
57
private
:
58
void
update()
override
;
59
bool
doGroup(
SocketGroup
* g,Uint32 & allowance,bt::TimeStamp now)
override
;
60
61
int
waitForSocketsReady();
62
};
63
64
}
65
66
#endif
net::NetworkThread
Definition:
networkthread.h:41
net::UploadThread::cap
static Uint32 cap()
Get the upload cap.
Definition:
uploadthread.h:53
net::SocketMonitor
Definition:
socketmonitor.h:45
net::UploadThread
Definition:
uploadthread.h:37
net::UploadThread::setCap
static void setCap(bt::Uint32 uc)
Set the upload cap.
Definition:
uploadthread.h:50
net::SocketGroup
Definition:
socketgroup.h:36
net::UploadThread::setSleepTime
static void setSleepTime(bt::Uint32 stime)
Set the sleep time when using upload caps.
net::UploadThread::signalDataReady
void signalDataReady()
Wake up thread, data is ready to be sent.
Generated by
1.8.20