mirror of
https://github.com/django/daphne.git
synced 2024-11-25 01:03:45 +03:00
Also close the socket on receive backpressure
This commit is contained in:
parent
ac7af23df1
commit
4c2c2d0fff
|
@ -100,7 +100,7 @@ class WebSocketProtocol(WebSocketServerProtocol):
|
|||
# You have to consume websocket.connect according to the spec,
|
||||
# so drop the connection.
|
||||
self.muted = True
|
||||
logger.warn("WebSocket force closed for %s due to backpressure", self.reply_channel)
|
||||
logger.warn("WebSocket force closed for %s due to connect backpressure", self.reply_channel)
|
||||
# Send code 1013 "try again later" with close.
|
||||
self.sendClose(code=1013)
|
||||
else:
|
||||
|
@ -132,9 +132,12 @@ class WebSocketProtocol(WebSocketServerProtocol):
|
|||
"text": payload.decode("utf8"),
|
||||
})
|
||||
except self.channel_layer.ChannelFull:
|
||||
# We don't drop the connection here as you don't _have_ to consume websocket.receive
|
||||
# TODO: Maybe add an option to drop if this is backlogged?
|
||||
pass
|
||||
# You have to consume websocket.receive according to the spec,
|
||||
# so drop the connection.
|
||||
self.muted = True
|
||||
logger.warn("WebSocket force closed for %s due to receive backpressure", self.reply_channel)
|
||||
# Send code 1013 "try again later" with close.
|
||||
self.sendClose(code=1013)
|
||||
|
||||
def serverSend(self, content, binary=False):
|
||||
"""
|
||||
|
|
Loading…
Reference in New Issue
Block a user