Skip to content

Commit 54dafbf

Browse files
committed
Record for which reason the connection got aborted
1 parent 8d899d1 commit 54dafbf

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

lib/em-websocket/connection.rb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ def dispatch(data)
118118
debug [:error, e]
119119
trigger_on_error(e)
120120
# Handshake errors require the connection to be aborted
121-
abort
121+
abort(:handshake_error)
122122
}
123123

124124
handshake
@@ -261,7 +261,8 @@ def close_timeout
261261

262262
# As definited in draft 06 7.2.2, some failures require that the server
263263
# abort the websocket connection rather than close cleanly
264-
def abort
264+
def abort(reason)
265+
debug [:abort, reason]
265266
close_connection
266267
end
267268

@@ -271,7 +272,7 @@ def close_websocket_private(code, body)
271272
@handler.close_websocket(code, body)
272273
else
273274
# The handshake hasn't completed - should be safe to terminate
274-
abort
275+
abort(:handshake_incomplete)
275276
end
276277
end
277278

0 commit comments

Comments
 (0)