mirror of
https://github.com/faye/websocket-driver-ruby.git
synced 2025-11-01 13:59:38 +00:00
Don't send a close frame in response to receiving one, if we already sent a close frame.
This commit is contained in:
@@ -246,7 +246,7 @@ module WebSocket
|
||||
end
|
||||
|
||||
def shutdown(code, reason)
|
||||
frame(reason, :close, code)
|
||||
frame(reason, :close, code) if @ready_state < 2
|
||||
@frame = @message = nil
|
||||
@ready_state = 3
|
||||
@stage = 5
|
||||
|
||||
@@ -457,6 +457,11 @@ describe WebSocket::Driver::Hybi do
|
||||
it "changes the state to :closed" do
|
||||
expect(driver.state).to eq :closed
|
||||
end
|
||||
|
||||
it "does not write another close frame" do
|
||||
expect(socket).not_to receive(:write)
|
||||
driver.parse [0x88, 0x04, 0x03, 0xe9, 0x4f, 0x4b].pack("C*")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user