Skip to content

Commit

Permalink
Merge pull request #133 from nekokatt/bugfix/restart-loop
Browse files Browse the repository at this point in the history
Fixed a logic error in websocket init logic
  • Loading branch information
davfsa authored Sep 8, 2020
2 parents 4846fef + 15da249 commit 9ea919f
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions hikari/impl/shard.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,16 +247,15 @@ async def connect(
raise errors.GatewayError(f"Unexpected {type(ex).__name__}: {ex}") from ex
finally:
if ws.closed:
return
logger.debug("ws was already closed")

if raised:
elif raised:
await ws.close(
code=errors.ShardCloseCode.UNEXPECTED_CONDITION,
message=b"unexpected fatal client error :-(",
)
return

if not ws._closing:
elif not ws._closing:
# We use a special close code here that prevents Discord
# randomly invalidating our session. Undocumented behaviour is
# nice like that...
Expand Down

0 comments on commit 9ea919f

Please sign in to comment.