fix, sciter, reconnect, check thread running before the state

Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
fufesou 2023-10-02 20:17:43 +08:00
parent 92213f9228
commit 0a60d7016d

View File

@ -888,11 +888,13 @@ impl<T: InvokeUiSession> Session<T> {
// 2. If the connection is established, send `Data::Close`.
// 3. If the connection is disconnected, do nothing.
let mut connection_round_state_lock = self.connection_round_state.lock().unwrap();
if self.thread.lock().unwrap().is_some() {
match connection_round_state_lock.state {
ConnectionState::Connecting => return,
ConnectionState::Connected => self.send(Data::Close),
ConnectionState::Disconnected => {}
}
}
let round = connection_round_state_lock.new_round();
drop(connection_round_state_lock);