aboutsummaryrefslogtreecommitdiffstats
path: root/actioncable/lib/action_cable/connection/stream.rb
diff options
context:
space:
mode:
authorJeremy Daer <jeremydaer@gmail.com>2016-03-20 13:59:02 -0700
committerJeremy Daer <jeremydaer@gmail.com>2016-03-20 17:36:22 -0700
commit4f8a8e2c065e4db1f4df0df2fd75338154c6be07 (patch)
treebfa7e833c7c8a4cc3d7c7af714fe06a274e3ebbe /actioncable/lib/action_cable/connection/stream.rb
parentdda31d59a03adb7e5aa372e72bb66a3886632f2f (diff)
downloadrails-4f8a8e2c065e4db1f4df0df2fd75338154c6be07.tar.gz
rails-4f8a8e2c065e4db1f4df0df2fd75338154c6be07.tar.bz2
rails-4f8a8e2c065e4db1f4df0df2fd75338154c6be07.zip
Gracefully handle disconnected clients
We'll get `Errno::ECONNRESET` if the client forcibly disconnected. Just close the socket rather than raising the exception. Handle other errors in `ClientSocket#write`, too, mirroring the Faye error handling which swallows all `StandardError` on write.
Diffstat (limited to 'actioncable/lib/action_cable/connection/stream.rb')
-rw-r--r--actioncable/lib/action_cable/connection/stream.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/actioncable/lib/action_cable/connection/stream.rb b/actioncable/lib/action_cable/connection/stream.rb
index 2d97b28c09..0cf59091bc 100644
--- a/actioncable/lib/action_cable/connection/stream.rb
+++ b/actioncable/lib/action_cable/connection/stream.rb
@@ -29,7 +29,7 @@ module ActionCable
def write(data)
return @rack_hijack_io.write(data) if @rack_hijack_io
return @stream_send.call(data) if @stream_send
- rescue EOFError
+ rescue EOFError, Errno::ECONNRESET
@socket_object.client_gone
end