lib/em-net-http.rb in em-net-http-0.2.4 vs lib/em-net-http.rb in em-net-http-0.2.5
- old
+ new
@@ -76,9 +76,18 @@
end
class HTTP
alias_method :orig_net_http_request, :request
+ alias_method :orig_net_http_do_start, :do_start
+
+ def do_start
+
+ return orig_net_http_do_start unless ::EM.reactor_running?
+
+ @started = true
+ end
+
def request(req, body = nil, &block)
return orig_net_http_request(req, body, &block) unless ::EM.reactor_running?
uri = Addressable::URI.parse("#{use_ssl? ? 'https://' : 'http://'}#{addr_port}#{req.path}")