webmcp
diff framework/bin/mcp.lua @ 215:ba3dd4a17e3d
Some code cleanup/rearrangement for request handling
author | jbe |
---|---|
date | Mon Jan 12 01:48:11 2015 +0100 (2015-01-12) |
parents | 6ac7133bb58e |
children | 7f9c9c4434a1 |
line diff
1.1 --- a/framework/bin/mcp.lua Sat Jan 10 10:44:17 2015 +0100 1.2 +++ b/framework/bin/mcp.lua Mon Jan 12 01:48:11 2015 +0100 1.3 @@ -188,10 +188,12 @@ 1.4 -- execute configurations 1.5 for i, config_name in ipairs(WEBMCP_CONFIG_NAMES) do 1.6 execute.config(config_name) 1.7 + execute.prefork_initializers() 1.8 end 1.9 1.10 -- interactive console mode 1.11 if WEBMCP_MODE == "interactive" then 1.12 + execute.postfork_initializers() 1.13 trace.disable() -- avoids memory leakage (TODO: needs general solution for moonbridge?) 1.14 end 1.15 1.16 @@ -199,13 +201,10 @@ 1.17 if WEBMCP_MODE == "listen" then 1.18 local http = require("moonbridge_http") 1.19 for i, listener in ipairs(listeners) do 1.20 - listener.prepare = execute.prefork_initializers 1.21 + listener.prepare = execute.postfork_initializers 1.22 listener.connect = http.generate_handler( 1.23 - request.get_http_options(), 1.24 - function(http_request) 1.25 - execute.postfork_initializers() 1.26 - request.handler(http_request) 1.27 - end 1.28 + request.handler, 1.29 + request.get_http_options() 1.30 ) 1.31 listener.finish = execute.finalizers 1.32 moonbridge_listen(listener)