Make HTTP::Server uninitialized instead of HTTP::Server?

This commit is contained in:
sdogruyol 2016-09-05 10:38:00 +03:00
parent 8dfe815dc0
commit 64d3271fb2
2 changed files with 5 additions and 5 deletions

View file

@ -11,8 +11,8 @@ module Kemal
config.setup
config.add_handler Kemal::RouteHandler::INSTANCE
config.server = HTTP::Server.new(config.host_binding.not_nil!, config.port, config.handlers)
config.server.not_nil!.tls = config.ssl
config.server = HTTP::Server.new(config.host_binding, config.port, config.handlers)
config.server.tls = config.ssl
Kemal::Sessions.run_reaper!
@ -26,7 +26,7 @@ module Kemal
unless config.env == "test"
Signal::INT.trap {
config.logger.write "Kemal is going to take a rest!\n"
config.server.not_nil!.close
config.server.close
exit
}
@ -40,7 +40,7 @@ module Kemal
end
config.logger.write "[#{config.env}] Kemal is ready to lead at #{config.scheme}://#{config.host_binding}:#{config.port}\n"
config.server.not_nil!.listen
config.server.listen
end
end
end

View file

@ -9,7 +9,6 @@ module Kemal
HANDLERS = [] of HTTP::Handler
ERROR_HANDLERS = {} of Int32 => HTTP::Server::Context -> String
@ssl : OpenSSL::SSL::Context::Server?
@server : HTTP::Server?
property host_binding, ssl, port, env, public_folder, logging,
always_rescue, serve_static, server, extra_options
@ -24,6 +23,7 @@ module Kemal
@logger = nil
@error_handler = nil
@always_rescue = true
@server = uninitialized HTTP::Server
end
def logger