Add draft for LocalCluster
This commit is contained in:
@@ -575,6 +575,12 @@ public:
|
||||
return std::move(*this);
|
||||
}
|
||||
|
||||
/* Register event handler for accepted FD. Can be used together with adoptSocket. */
|
||||
TemplatedApp &&preOpen(LIBUS_SOCKET_DESCRIPTOR (*handler)(LIBUS_SOCKET_DESCRIPTOR)) {
|
||||
httpContext->onPreOpen(handler);
|
||||
return std::move(*this);
|
||||
}
|
||||
|
||||
/* adopt an externally accepted socket */
|
||||
TemplatedApp &&adoptSocket(LIBUS_SOCKET_DESCRIPTOR accepted_fd) {
|
||||
httpContext->adoptAcceptedSocket(accepted_fd);
|
||||
@@ -586,6 +592,10 @@ public:
|
||||
return std::move(*this);
|
||||
}
|
||||
|
||||
Loop *getLoop() {
|
||||
return (Loop *) httpContext->getLoop();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
typedef TemplatedApp<false> App;
|
||||
|
||||
@@ -46,6 +46,10 @@ private:
|
||||
/* Minimum allowed receive throughput per second (clients uploading less than 16kB/sec get dropped) */
|
||||
static const int HTTP_RECEIVE_THROUGHPUT_BYTES = 16 * 1024;
|
||||
|
||||
us_loop_t *getLoop() {
|
||||
return us_socket_context_loop(SSL, getSocketContext());
|
||||
}
|
||||
|
||||
us_socket_context_t *getSocketContext() {
|
||||
return (us_socket_context_t *) this;
|
||||
}
|
||||
@@ -483,6 +487,10 @@ public:
|
||||
return us_socket_context_listen_unix(SSL, getSocketContext(), path, options, sizeof(HttpResponseData<SSL>));
|
||||
}
|
||||
|
||||
void onPreOpen(LIBUS_SOCKET_DESCRIPTOR (*handler)(LIBUS_SOCKET_DESCRIPTOR)) {
|
||||
us_socket_context_on_pre_open(SSL, getSocketContext(), handler);
|
||||
}
|
||||
|
||||
/* Adopt an externally accepted socket into this HttpContext */
|
||||
us_socket_t *adoptAcceptedSocket(LIBUS_SOCKET_DESCRIPTOR accepted_fd) {
|
||||
return us_adopt_accepted_socket(SSL, getSocketContext(), accepted_fd, sizeof(HttpResponseData<SSL>), 0, 0);
|
||||
|
||||
Reference in New Issue
Block a user