jbe@1167: if config.fork == nil then bsw@1158: config.fork = {} bsw@1158: end bsw@1158: jbe@1167: if config.fork.pre == nil then jbe@1167: config.fork.pre = 2 bsw@1158: end bsw@1158: jbe@1167: if config.fork.min == nil then jbe@1167: config.fork.min = 4 jbe@1167: end jbe@1167: jbe@1167: if config.fork.max == nil then bsw@1169: config.fork.max = 128 bsw@1158: end bsw@1158: jbe@1167: if config.fork.delay == nil then jbe@1167: config.fork.delay = 0.125 jbe@1167: end jbe@1167: jbe@1167: if config.fork.error_delay == nil then jbe@1167: config.fork.error_delay = 2 bsw@1158: end bsw@1158: jbe@1167: if config.fork.exit_delay == nil then jbe@1167: config.fork.exit_delay = 2 jbe@1167: end jbe@1167: jbe@1167: if config.fork.idle_timeout == nil then jbe@1167: config.fork.idle_timeout = 900 jbe@1167: end jbe@1167: jbe@1167: if config.port == nil then bsw@1158: config.port = 8080 bsw@1158: end bsw@1158: bsw@1158: if config.localhost == nil then bsw@1158: config.localhost = true bsw@1158: end bsw@1158: jbe@1167: local listen_options = { jbe@1167: pre_fork = config.fork.pre, jbe@1167: min_fork = config.fork.min, jbe@1167: max_fork = config.fork.max, jbe@1167: fork_delay = config.fork.delay, jbe@1167: fork_error_delay = config.fork.error_delay, jbe@1167: exit_delay = config.fork.exit_delay, jbe@1167: idle_timeout = config.fork.idle_timeout, bsw@1169: memory_limit = config.fork.memory_limit, jbe@1167: min_requests_per_fork = config.fork.min_requests, jbe@1167: max_requests_per_fork = config.fork.max_requests, jbe@1167: http_options = config.http_options jbe@1167: } jbe@1167: jbe@1167: if config.ipv6 then bsw@1199: local host = config.localhost and "::1" or "::" bsw@1199: listen_options[#listen_options+1] = { proto = "tcp", host = host, port = config.port } jbe@1167: end jbe@1167: if config.ipv6 ~= "only" then bsw@1202: local host = config.localhost and "127.0.0.1" or "0.0.0.0" bsw@1199: listen_options[#listen_options+1] = { proto = "tcp", host = host, port = config.port } jbe@1167: end jbe@1167: jbe@1167: listen(listen_options) jbe@1167: bsw@1158: listen{ jbe@1167: { jbe@1167: proto = "interval", jbe@1167: name = "send_pending_notifications", jbe@1167: delay = 5, jbe@1167: handler = function() jbe@1167: Event:send_pending_notifications() jbe@1167: end jbe@1167: }, jbe@1167: min_fork = 1, jbe@1167: max_fork = 1 bsw@1158: } bsw@1158: bsw@1158: execute.inner() bsw@1158: