Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions src/client.toit
Original file line number Diff line number Diff line change
Expand Up @@ -709,10 +709,16 @@ class Client:
if connection_ and connection_.is-open_:
if location.can-reuse-connection connection_.location_:
connection_.drain_ // Remove any remnants of previous requests.
return true
// Hostname etc. didn't match so we need a new connection.
connection_.close
connection_ = null
// The 'drain' may have closed the connection. Check again.
if connection_:
if connection_.is-open_:
return true
else:
connection_ = null
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if connection_:
if connection_.is-open_:
return true
else:
connection_ = null
if connection_.is-open_ and connection_.is-open_: return true
connection_ = null

Maybe also share the setting of connection_ = null with the following else part.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

else:
// Hostname etc. didn't match so we need a new connection.
connection_.close
connection_ = null
socket/tcp.Socket := interface_.tcp-connect location.host location.port
if location.use-tls:
// Wrap the socket in TLS.
Expand Down
Loading