lib/async/http/protocol/http1/finishable.rb in async-http-0.78.0 vs lib/async/http/protocol/http1/finishable.rb in async-http-0.79.0
- old
+ new
@@ -30,22 +30,26 @@
super
end
def close(error = nil)
+ super
+
unless @closed.resolved?
@error = error
@closed.value = true
end
-
- super
end
- def wait
+ def wait(persistent = true)
if @reading
@closed.wait
- else
+ elsif persistent
+ # If the connection can be reused, let's gracefully discard the body:
self.discard
+ else
+ # Else, we don't care about the body, so we can close it immediately:
+ self.close
end
end
def inspect
"#<#{self.class} closed=#{@closed} error=#{@error}> | #{super}"