From: Alexis Laferrière Date: Wed, 6 Jan 2016 18:54:46 +0000 (-0500) Subject: lib/nitcorn: skip the listening loop when running continuous integration tests X-Git-Tag: v0.8~17^2~1 X-Git-Url: http://nitlanguage.org lib/nitcorn: skip the listening loop when running continuous integration tests Signed-off-by: Alexis Laferrière --- diff --git a/lib/nitcorn/reactor.nit b/lib/nitcorn/reactor.nit index 5bd285d..0fb5cad 100644 --- a/lib/nitcorn/reactor.nit +++ b/lib/nitcorn/reactor.nit @@ -133,10 +133,18 @@ class HttpFactory redef fun spawn_connection(buf_ev) do return new HttpServer(buf_ev, self) - # Launch the main loop of this server + # 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 - event_base.dispatch + if "NIT_TESTING".environ != "true" then + event_base.dispatch + end + event_base.destroy end end