diff --git a/lib/thin/backends/base.rb b/lib/thin/backends/base.rb index da3ad00a..ee7f3e46 100644 --- a/lib/thin/backends/base.rb +++ b/lib/thin/backends/base.rb @@ -45,16 +45,16 @@ def initialize # Start the backend and connect it. def start @stopping = false - # Allow for early run up of eventmachine. TODO : maybe move this into - # a method or proc to DRY. - if EventMachine.reactor_running? + starter = proc do connect @running = true + end + + # Allow for early run up of eventmachine. + if EventMachine.reactor_running? + starter.call else - EventMachine.run do - connect - @running = true - end + EventMachine.run(&starter) end end diff --git a/spec/request/parser_spec.rb b/spec/request/parser_spec.rb index 4e48f950..80b85432 100644 --- a/spec/request/parser_spec.rb +++ b/spec/request/parser_spec.rb @@ -169,7 +169,7 @@ sorta_safe.size.should == nread parser.should be_finished - parser.should_not have_error + parser.should_not be_error end end