gateway: do not dispatch raw events when state isn't set

this is possible if a connection quickly disconnects while connecting

close #136
This commit is contained in:
Luna 2022-08-13 22:43:09 -03:00
parent 17e851e95f
commit 5bd292422b
1 changed files with 6 additions and 0 deletions

View File

@ -397,6 +397,12 @@ class GatewayWebsocket:
such as READY and RESUMED, or events that are replies to such as READY and RESUMED, or events that are replies to
messages in the websocket. messages in the websocket.
""" """
if not self.state:
log.warning(
"can not dispatch {!r} as there is no state in ws {!r}", event, self
)
return
payload = { payload = {
"op": OP.DISPATCH, "op": OP.DISPATCH,
"t": event.upper(), "t": event.upper(),