forked from treefrogframework/treefrog-framework
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtactionthread.h
43 lines (33 loc) · 1006 Bytes
/
tactionthread.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#ifndef TACTIONTHREAD_H
#define TACTIONTHREAD_H
#include <QThread>
#include <TActionContext>
class THttpSocket;
class THttpRequest;
class THttpRequestHeader;
class THttpResponseHeader;
class QIODevice;
class T_CORE_EXPORT TActionThread : public QThread, public TActionContext
{
Q_OBJECT
public:
TActionThread(int socket, int maxThreads = 0);
virtual ~TActionThread();
static int threadCount();
static bool waitForAllDone(int msec);
static QList<THttpRequest> readRequest(THttpSocket *socket);
protected:
void run() override;
void emitError(int socketError) override;
qint64 writeResponse(THttpResponseHeader &header, QIODevice *body) override;
void closeHttpSocket() override;
bool handshakeForWebSocket(const THttpRequestHeader &header);
signals:
void error(int socketError);
private:
THttpSocket *_httpSocket {nullptr};
int _maxThreads {0};
T_DISABLE_COPY(TActionThread)
T_DISABLE_MOVE(TActionThread)
};
#endif // TACTIONTHREAD_H