nitcorn :: HttpFactory :: defaultinit
# Factory to create `HttpServer` instances, and hold the libevent base handler
class HttpFactory
super ConnectionFactory
# Configuration of this server
#
# It should be populated after this object has instanciated
var config = new ServerConfig.with_factory(self)
# Instantiate a server and libvent
#
# You can use this to create the first `HttpFactory`, which is the most common.
init and_libevent do init(new NativeEventBase)
redef fun spawn_connection(buf_ev, address) do return new HttpServer(buf_ev, self, address)
# Execute the main listening loop to accept connections
#
# After the loop ends, the underlying resources are freed.
#
# When the environment variable `NIT_TESTING` is set to `true`,
# the loop is not executed but the resources are still freed.
fun run
do
if "NIT_TESTING".environ != "true" then
event_base.dispatch
end
event_base.free
end
end
lib/nitcorn/reactor.nit:123,1--153,3