summaryrefslogtreecommitdiffstats
path: root/lib/puppet
diff options
context:
space:
mode:
Diffstat (limited to 'lib/puppet')
-rw-r--r--lib/puppet/network/http/webrick.rb9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/puppet/network/http/webrick.rb b/lib/puppet/network/http/webrick.rb
index a60a22ba1..bf4bf8859 100644
--- a/lib/puppet/network/http/webrick.rb
+++ b/lib/puppet/network/http/webrick.rb
@@ -31,13 +31,20 @@ class Puppet::Network::HTTP::WEBrick
arguments.merge!(setup_ssl)
@server = WEBrick::HTTPServer.new(arguments)
+ @server.listeners.each { |l| l.start_immediately = false }
setup_handlers
@mutex.synchronize do
raise "WEBrick server is already listening" if @listening
@listening = true
- @thread = Thread.new { @server.start }
+ @thread = Thread.new {
+ @server.start { |sock|
+ raise "Client disconnected before connection could be established" unless IO.select([sock],nil,nil,0.1)
+ sock.accept
+ @server.run(sock)
+ }
+ }
end
end