Fix: Move WS error handling (#174)

Moves all WS handling of unexpected payloads into the stream to prevent code duplication.

This also prevents non-{Hello,Resumed,Ready} messages from causing a handshake failure, as it seems Discord do not prevent such messages from appearing.

---------

Co-authored-by: Kyle Simpson <kyleandrew.simpson@gmail.com>
This commit is contained in:
Erk
2023-04-11 13:01:07 +02:00
committed by Kyle Simpson
parent 4d0c1c030d
commit 500d679ae5
6 changed files with 9 additions and 27 deletions

View File

@@ -90,7 +90,6 @@ impl From<&ConnectionError> for DisconnectReason {
| ConnectionError::CryptoModeInvalid
| ConnectionError::CryptoModeUnavailable
| ConnectionError::EndpointUrl
| ConnectionError::ExpectedHandshake
| ConnectionError::IllegalDiscoveryResponse
| ConnectionError::IllegalIp
| ConnectionError::Json(_) => Self::ProtocolViolation,