Skip to content

Commit

Permalink
lightclient: Close the socket if not already closing
Browse files Browse the repository at this point in the history
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
  • Loading branch information
lexnv committed Nov 27, 2023
1 parent 099f6ee commit abe77b5
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions lightclient/src/platform/wasm_socket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -242,9 +242,7 @@ impl AsyncWrite for WasmSocket {

impl Drop for WasmSocket {
fn drop(&mut self) {
if self.socket.ready_state() == web_sys::WebSocket::OPEN
|| self.socket.ready_state() == web_sys::WebSocket::CONNECTING
{
if self.socket.ready_state() != web_sys::WebSocket::CLOSING {
let _ = self.socket.close();
}

Expand Down

0 comments on commit abe77b5

Please sign in to comment.