Skip to content

Commit

Permalink
Ensure socket is open before calling readable?.
Browse files Browse the repository at this point in the history
  • Loading branch information
ioquatix committed Apr 20, 2024
1 parent ca71154 commit ad1bd35
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/async/http/protocol/http1/connection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def concurrency

# Can we use this connection to make requests?
def viable?
@ready && @stream&.readable?
@ready && !@stream.closed? && @stream&.readable?
end

def reusable?
Expand Down
2 changes: 1 addition & 1 deletion lib/async/http/protocol/http1/request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def self.read(connection)
self.new(connection, *parts)
end
end

UPGRADE = 'upgrade'

def initialize(connection, authority, method, path, version, headers, body)
Expand Down
2 changes: 1 addition & 1 deletion lib/async/http/protocol/http2/connection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def concurrency

# Can we use this connection to make requests?
def viable?
@stream.readable?
!@stream.closed? && @stream.readable?
end

def reusable?
Expand Down

0 comments on commit ad1bd35

Please sign in to comment.