libktorrent
2.2.0
src
net
wakeuppipe.h
1
/***************************************************************************
2
* Copyright (C) 2009 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 KTWAKEUPPIPE_H
21
#define KTWAKEUPPIPE_H
22
23
#include <ktorrent_export.h>
24
#include <util/pipe.h>
25
#include <net/poll.h>
26
#include <QMutex>
27
28
namespace
net
29
{
30
37
class
KTORRENT_EXPORT
WakeUpPipe
:
public
bt::Pipe
,
public
PollClient
38
{
39
public
:
40
WakeUpPipe
();
41
~
WakeUpPipe
()
override
;
42
44
virtual
void
wakeUp
();
45
47
void
handleData
()
override
;
48
49
int
fd
()
const override
{
return
readerSocket();}
50
51
void
reset
()
override
;
52
54
bool
wokenUp
()
const
{
return
woken_up;}
55
56
typedef
QSharedPointer<WakeUpPipe> Ptr;
57
protected
:
58
mutable
QMutex mutex;
59
bool
woken_up;
60
};
61
62
}
63
64
#endif
net::PollClient
Definition:
poll.h:43
net::WakeUpPipe
Definition:
wakeuppipe.h:38
net::WakeUpPipe::handleData
void handleData() override
Read all the dummy data.
net::WakeUpPipe::reset
void reset() override
Reset the client called after poll finishes.
net::WakeUpPipe::wakeUp
virtual void wakeUp()
Wake up the other socket.
net::WakeUpPipe::wokenUp
bool wokenUp() const
Have we been woken up.
Definition:
wakeuppipe.h:54
bt::Pipe
Definition:
pipe.h:34
net::WakeUpPipe::fd
int fd() const override
Get the filedescriptor to poll.
Definition:
wakeuppipe.h:49
Generated by
1.8.20