From 3c4106d2ebdcf5e8dd837c0526faf7bfb89e2306 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Alexis=20Laferri=C3=A8re?= Date: Wed, 6 Jan 2016 13:54:46 -0500 Subject: [PATCH] lib/nitcorn: skip the listening loop when running continuous integration tests MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Alexis Laferrière --- lib/nitcorn/reactor.nit | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) 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 -- 1.7.9.5