We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 30e988f commit 98277d3Copy full SHA for 98277d3
lib/async/container/supervisor/connection.rb
@@ -253,8 +253,9 @@ def next_id
253
#
254
# @parameter message [Hash] The message to write.
255
def write(**message)
256
+ raise IOError, "Connection is closed!" unless @stream
257
@stream&.write(JSON.dump(message) << "\n")
- @stream&.flush
258
+ @stream&.flush # it is possible for @stream to become nil after the write call
259
end
260
261
# Read a message from the connection stream.
@@ -327,9 +328,9 @@ def close
327
328
@reader = nil
329
330
- if @stream
331
- @stream.close
+ if stream = @stream
332
@stream = nil
333
+ stream.close
334
335
336
if @calls
0 commit comments