fix reconnect when reset by the peer && improper 10054 reconnect

Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
21pages
2022-12-19 15:09:08 +08:00
parent ea38e70974
commit 277a4b1b29
3 changed files with 24 additions and 6 deletions

View File

@@ -107,6 +107,7 @@ impl<T: InvokeUiSession> Remote<T> {
SERVER_CLIPBOARD_ENABLED.store(true, Ordering::SeqCst);
SERVER_FILE_TRANSFER_ENABLED.store(true, Ordering::SeqCst);
self.handler.set_connection_type(peer.is_secured(), direct); // flutter -> connection_ready
self.handler.set_connection_info(direct, false);
// just build for now
#[cfg(not(windows))]
@@ -144,7 +145,10 @@ impl<T: InvokeUiSession> Remote<T> {
}
Ok(ref bytes) => {
last_recv_time = Instant::now();
received = true;
if !received {
received = true;
self.handler.set_connection_info(direct, true);
}
self.data_count.fetch_add(bytes.len(), Ordering::Relaxed);
if !self.handle_msg_from_peer(bytes, &mut peer).await {
break