-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathHttpServiceWorker
More file actions
63 lines (47 loc) · 1.41 KB
/
HttpServiceWorker
File metadata and controls
63 lines (47 loc) · 1.41 KB
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/*
* Copyright (C) 2021 Frank Mertens.
*
* Distribution and use is allowed under the terms of the GNU General Public License version 3
* (see CoreComponents/LICENSE-gpl-3.0).
*
*/
#pragma once
#include <cc/HttpServerConfig>
#include <cc/HttpClientConnection>
#include <cc/HttpServiceInstance>
#include <cc/PriorityChannel>
#include <cc/Channel>
namespace cc { class HttpResponseGenerator; }
namespace cc { class TlsSessionCache; }
namespace cc {
using PendingConnections = PriorityChannel<HttpClientConnection>;
using ClosedConnections = Channel<HttpClientConnection>;
class HttpServiceWorkerState;
/** \internal
* \class HttpServiceWorker cc/HttpServiceWorker
* \ingroup http_server
* \brief Threaded background worker
*/
class HttpServiceWorker final: public Object
{
public:
HttpServiceWorker() = default;
HttpServiceWorker(
const HttpServerConfig &nodeConfig,
const PendingConnections &pendingConnections,
const ClosedConnections &closedConnections,
const TlsSessionCache &sessionCache
);
void start();
const HttpServerConfig &nodeConfig() const;
const HttpServiceInstance &serviceInstance() const;
HttpClientConnection &client();
void closeConnection();
private:
friend class HttpServiceDelegate;
using State = HttpServiceWorkerState;
HttpResponseGenerator &response();
State &me();
const State &me() const;
};
} // namespace cc