Crystal 0.25.0 (#452)

This commit is contained in:
Serdar Dogruyol 2018-06-16 18:03:00 +03:00 committed by GitHub
parent c2236acf3a
commit a5870e7d24
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 23 additions and 22 deletions

View file

@ -59,7 +59,7 @@ module Kemal
end
end
config.server ||= HTTP::Server.new(config.host_binding, config.port, config.handlers)
server = config.server ||= HTTP::Server.new(config.handlers)
{% if !flag?(:without_openssl) %}
config.server.not_nil!.tls = config.ssl
@ -68,13 +68,13 @@ module Kemal
config.running = true
yield config
config.server.not_nil!.listen if config.env != "test" && config.server
server.listen(config.host_binding, config.port) if config.env != "test"
end
def self.stop
if config.running
if config.server
config.server.not_nil!.close
if server = config.server
server.close unless server.closed?
config.running = false
else
raise "Kemal.config.server is not set. Please use Kemal.run to set the server."