Skip to content

Commit 7e0f1b6

Browse files
committed
Improve implementation of viable?.
1 parent ad1bd35 commit 7e0f1b6

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

lib/async/http/protocol/http1/connection.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def concurrency
5252

5353
# Can we use this connection to make requests?
5454
def viable?
55-
@ready && !@stream.closed? && @stream&.readable?
55+
@ready && @stream && !@stream.closed? && @stream.readable?
5656
end
5757

5858
def reusable?

lib/async/http/protocol/http2/connection.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ def concurrency
129129

130130
# Can we use this connection to make requests?
131131
def viable?
132-
!@stream.closed? && @stream.readable?
132+
@stream && !@stream.closed? && @stream.readable?
133133
end
134134

135135
def reusable?

0 commit comments

Comments
 (0)