patch: fix server file_transfer not enabled
Signed-off-by: ClSlaid <cailue@bupt.edu.cn>
This commit is contained in:
		
							parent
							
								
									fbb1d9247f
								
							
						
					
					
						commit
						1f52bb35ba
					
				| @ -214,7 +214,7 @@ fn send_data_to_channel(conn_id: i32, data: ClipboardFile) { | ||||
|         .iter() | ||||
|         .find(|x| x.conn_id == conn_id) | ||||
|     { | ||||
|         log::debug!("send data to connection: {}", conn_id); | ||||
|         log::debug!("send data to connection: {}, data = {:?}", conn_id, data); | ||||
|         allow_err!(msg_channel.sender.send(data)); | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -730,7 +730,11 @@ fn send_format_list(conn_id: i32) -> Result<(), CliprdrError> { | ||||
| } | ||||
| 
 | ||||
| fn send_file_list(paths: Vec<PathBuf>, conn_id: i32) -> Result<(), CliprdrError> { | ||||
|     log::debug!("send file list to remote, conn={}", conn_id); | ||||
|     log::debug!( | ||||
|         "send file list to remote, conn={}, list={:?}", | ||||
|         conn_id, | ||||
|         paths | ||||
|     ); | ||||
|     let files = construct_file_list(paths.as_slice())?; | ||||
| 
 | ||||
|     let mut data = BytesMut::with_capacity(4 + 592 * files.len()); | ||||
|  | ||||
| @ -126,7 +126,8 @@ impl SysClipboard for X11Clipboard { | ||||
|             }; | ||||
| 
 | ||||
|             if self.is_stopped() { | ||||
|                 break; | ||||
|                 std::thread::sleep(std::time::Duration::from_millis(100)); | ||||
|                 continue; | ||||
|             } | ||||
| 
 | ||||
|             let Some(paths) = sth else { | ||||
| @ -162,6 +163,7 @@ impl SysClipboard for X11Clipboard { | ||||
| 
 | ||||
|             if let Err(e) = send_format_list(0) { | ||||
|                 log::warn!("failed to send format list: {}", e); | ||||
|                 break; | ||||
|             } | ||||
| 
 | ||||
|             std::thread::sleep(std::time::Duration::from_millis(100)); | ||||
|  | ||||
| @ -382,7 +382,7 @@ impl<T: InvokeUiCM> IpcTaskRunner<T> { | ||||
|                                     log::debug!("conn_id: {}", id); | ||||
|                                     self.cm.add_connection(id, is_file_transfer, port_forward, peer_id, name, authorized, keyboard, clipboard, audio, file, restart, recording, from_switch,self.tx.clone()); | ||||
|                                     self.conn_id = id; | ||||
|                                     #[cfg(windows)] | ||||
|                                     #[cfg(any(target_os = "linux", target_os = "windows"))] | ||||
|                                     { | ||||
|                                         self.file_transfer_enabled = _file_transfer_enabled; | ||||
|                                     } | ||||
| @ -489,7 +489,7 @@ impl<T: InvokeUiCM> IpcTaskRunner<T> { | ||||
|                     } | ||||
|                     match &data { | ||||
|                         Data::SwitchPermission{name: _name, enabled: _enabled} => { | ||||
|                             #[cfg(windows)] | ||||
|                             #[cfg(any(target_os="linux", target_os="windows"))] | ||||
|                             if _name == "file" { | ||||
|                                 self.file_transfer_enabled = *_enabled; | ||||
|                             } | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user