Socket-based HTTP server that accepts connections and dispatches requests to worker threads.
Declared in <httpserver.h>
class HTTPServer;
| Name | Description |
|---|---|
Id | Each connection is assigned an unique id of this type. |
| Name | Description |
|---|---|
HTTPServer [constructor] | Construct a server that dispatches each parsed request to the given handler. |
~HTTPServer [destructor] [virtual] | Destroy the server, asserting that all threads, connections and listeners were stopped. |
BindAndStartListening | Bind to a new address:port, start listening and add the listen socket to m_listen. |
ClearConnectedClients | Force-remove all remaining clients from m_connected without waiting for graceful disconnection. Must only be called after JoinSocketsThreads(). |
DisconnectAllClients | Start disconnecting clients when possible in the I/O loop |
GetConnectionsCount | Get the number of HTTPRemoteClients we are connected to |
GetListeningSocketCount | Get the number of sockets the server is bound to and listening on |
InitHTTPAllowList | Parse the user's -rpcallowip settings and populate m_allow_subnets |
InterruptNet | Stop network activity |
JoinSocketsThreads | Join (wait for) the threads started by StartSocketsThreads() to exit. |
SetMaxConnections | Set the maximum amount of connected HTTPClients (-rpcmaxconnections) |
SetRequestHandler | Update the request handler method. Used for shutdown to reject new requests. |
SetServerTimeout | Set the idle client timeout (-rpcservertimeout) |
StartSocketsThreads | Start the necessary threads for sockets IO. |
StopAccepting | Stop accepting new connections in the I/O loop. Must be called first in StopHTTPServer() before DisconnectAllClients(). A connection accepted after the "wait for 0 connections" loop exits would remain in m_connected when the destructor is called. |
StopListening | Stop listening by closing all listening sockets. |