lib/faye/websocket/api.rb in faye-websocket-0.11.0 vs lib/faye/websocket/api.rb in faye-websocket-0.11.1
- old
+ new
@@ -84,11 +84,14 @@
raise ArgumentError, "Failed to execute 'close' on WebSocket: " +
"The code must be either 1000, or between 3000 and 4999. " +
"#{ code } is neither."
end
+ if @ready_state < CLOSING
+ @close_timer = EventMachine.add_timer(CLOSE_TIMEOUT) { begin_close('', 1006) }
+ end
+
@ready_state = CLOSING unless @ready_state == CLOSED
- @close_timer = EventMachine.add_timer(CLOSE_TIMEOUT) { begin_close('', 1006) }
@driver.close(reason, code)
end
def protocol