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:
@@ -95,8 +95,6 @@ impl Connection {
|
||||
},
|
||||
other => {
|
||||
debug!("Expected ready/hello; got: {:?}", other);
|
||||
|
||||
return Err(Error::ExpectedHandshake);
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -304,8 +302,6 @@ impl Connection {
|
||||
},
|
||||
other => {
|
||||
debug!("Expected resumed/hello; got: {:?}", other);
|
||||
|
||||
return Err(Error::ExpectedHandshake);
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user