commit
						c5feb95509
					
				| @ -892,8 +892,6 @@ pub struct LoginConfigHandler { | |||||||
|     pub supported_encoding: Option<(bool, bool)>, |     pub supported_encoding: Option<(bool, bool)>, | ||||||
|     pub restarting_remote_device: bool, |     pub restarting_remote_device: bool, | ||||||
|     pub force_relay: bool, |     pub force_relay: bool, | ||||||
|     pub direct: Option<bool>, |  | ||||||
|     pub received: bool, |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| impl Deref for LoginConfigHandler { | impl Deref for LoginConfigHandler { | ||||||
| @ -931,8 +929,6 @@ impl LoginConfigHandler { | |||||||
|         self.supported_encoding = None; |         self.supported_encoding = None; | ||||||
|         self.restarting_remote_device = false; |         self.restarting_remote_device = false; | ||||||
|         self.force_relay = !self.get_option("force-always-relay").is_empty(); |         self.force_relay = !self.get_option("force-always-relay").is_empty(); | ||||||
|         self.direct = None; |  | ||||||
|         self.received = false; |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     /// Check if the client should auto login.
 |     /// Check if the client should auto login.
 | ||||||
| @ -1819,7 +1815,6 @@ pub trait Interface: Send + Clone + 'static + Sized { | |||||||
|     fn handle_login_error(&mut self, err: &str) -> bool; |     fn handle_login_error(&mut self, err: &str) -> bool; | ||||||
|     fn handle_peer_info(&mut self, pi: PeerInfo); |     fn handle_peer_info(&mut self, pi: PeerInfo); | ||||||
|     fn set_force_relay(&mut self, direct: bool, received: bool); |     fn set_force_relay(&mut self, direct: bool, received: bool); | ||||||
|     fn set_connection_info(&mut self, direct: bool, received: bool); |  | ||||||
|     fn is_file_transfer(&self) -> bool; |     fn is_file_transfer(&self) -> bool; | ||||||
|     fn is_port_forward(&self) -> bool; |     fn is_port_forward(&self) -> bool; | ||||||
|     fn is_rdp(&self) -> bool; |     fn is_rdp(&self) -> bool; | ||||||
| @ -1995,10 +1990,11 @@ lazy_static::lazy_static! { | |||||||
| /// * `title` - The title of the message.
 | /// * `title` - The title of the message.
 | ||||||
| /// * `text` - The text of the message.
 | /// * `text` - The text of the message.
 | ||||||
| #[inline] | #[inline] | ||||||
| pub fn check_if_retry(msgtype: &str, title: &str, text: &str, retry_for_relay: bool) -> bool { | pub fn check_if_retry(msgtype: &str, title: &str, text: &str) -> bool { | ||||||
|     msgtype == "error" |     msgtype == "error" | ||||||
|         && title == "Connection Error" |         && title == "Connection Error" | ||||||
|         && ((text.contains("10054") || text.contains("104")) && retry_for_relay |         && (text.contains("10054") | ||||||
|  |             || text.contains("104") | ||||||
|             || (!text.to_lowercase().contains("offline") |             || (!text.to_lowercase().contains("offline") | ||||||
|                 && !text.to_lowercase().contains("exist") |                 && !text.to_lowercase().contains("exist") | ||||||
|                 && !text.to_lowercase().contains("handshake") |                 && !text.to_lowercase().contains("handshake") | ||||||
|  | |||||||
| @ -107,7 +107,6 @@ impl<T: InvokeUiSession> Remote<T> { | |||||||
|                 SERVER_CLIPBOARD_ENABLED.store(true, Ordering::SeqCst); |                 SERVER_CLIPBOARD_ENABLED.store(true, Ordering::SeqCst); | ||||||
|                 SERVER_FILE_TRANSFER_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_type(peer.is_secured(), direct); // flutter -> connection_ready
 | ||||||
|                 self.handler.set_connection_info(direct, false); |  | ||||||
| 
 | 
 | ||||||
|                 // just build for now
 |                 // just build for now
 | ||||||
|                 #[cfg(not(windows))] |                 #[cfg(not(windows))] | ||||||
| @ -145,10 +144,7 @@ impl<T: InvokeUiSession> Remote<T> { | |||||||
|                                     } |                                     } | ||||||
|                                     Ok(ref bytes) => { |                                     Ok(ref bytes) => { | ||||||
|                                         last_recv_time = Instant::now(); |                                         last_recv_time = Instant::now(); | ||||||
|                                         if !received { |                                         received = true; | ||||||
|                                             received = true; |  | ||||||
|                                             self.handler.set_connection_info(direct, true); |  | ||||||
|                                         } |  | ||||||
|                                         self.data_count.fetch_add(bytes.len(), Ordering::Relaxed); |                                         self.data_count.fetch_add(bytes.len(), Ordering::Relaxed); | ||||||
|                                         if !self.handle_msg_from_peer(bytes, &mut peer).await { |                                         if !self.handle_msg_from_peer(bytes, &mut peer).await { | ||||||
|                                             break
 |                                             break
 | ||||||
|  | |||||||
| @ -658,10 +658,7 @@ impl<T: InvokeUiSession> Interface for Session<T> { | |||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     fn msgbox(&self, msgtype: &str, title: &str, text: &str, link: &str) { |     fn msgbox(&self, msgtype: &str, title: &str, text: &str, link: &str) { | ||||||
|         let direct = self.lc.read().unwrap().direct.unwrap_or_default(); |         let retry = check_if_retry(msgtype, title, text); | ||||||
|         let received = self.lc.read().unwrap().received; |  | ||||||
|         let retry_for_relay = direct && !received; |  | ||||||
|         let retry = check_if_retry(msgtype, title, text, retry_for_relay); |  | ||||||
|         self.ui_handler.msgbox(msgtype, title, text, link, retry); |         self.ui_handler.msgbox(msgtype, title, text, link, retry); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
| @ -749,12 +746,6 @@ impl<T: InvokeUiSession> Interface for Session<T> { | |||||||
|         } |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     fn set_connection_info(&mut self, direct: bool, received: bool) { |  | ||||||
|         let mut lc = self.lc.write().unwrap(); |  | ||||||
|         lc.direct = Some(direct); |  | ||||||
|         lc.received = received; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     fn set_force_relay(&mut self, direct: bool, received: bool) { |     fn set_force_relay(&mut self, direct: bool, received: bool) { | ||||||
|         let mut lc = self.lc.write().unwrap(); |         let mut lc = self.lc.write().unwrap(); | ||||||
|         lc.force_relay = false; |         lc.force_relay = false; | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user