[mio] 启动成功输出

This commit is contained in:
lubeilin
2024-03-06 22:53:56 +08:00
parent c0e930a3ef
commit ae63ce80b5
4 changed files with 9 additions and 0 deletions
+3
View File
@@ -7,6 +7,9 @@ use vnt::{DeviceInfo, ErrorInfo, HandshakeInfo, RegisterInfo, VntCallback};
pub struct VntHandler {} pub struct VntHandler {}
impl VntCallback for VntHandler { impl VntCallback for VntHandler {
fn success(&self) {
println!(" ====== Connect Successfully ====== ")
}
fn create_tun(&self, info: DeviceInfo) { fn create_tun(&self, info: DeviceInfo) {
println!("create_tun {}", info) println!("create_tun {}", info)
} }
+2
View File
@@ -145,6 +145,8 @@ impl CallBack {
} }
impl VntCallback for CallBack { impl VntCallback for CallBack {
fn success(&self) {
}
fn create_tun(&self, info: DeviceInfo) { fn create_tun(&self, info: DeviceInfo) {
if let Err(e) = self.create_tun0(info) { if let Err(e) = self.create_tun0(info) {
log::warn!("create_tun {:?}", e); log::warn!("create_tun {:?}", e);
+3
View File
@@ -182,6 +182,9 @@ impl Into<u8> for ErrorType {
} }
pub trait VntCallback: Clone + Send + Sync + 'static { pub trait VntCallback: Clone + Send + Sync + 'static {
/// 启动成功
fn success(&self) {}
/// 创建网卡的信息 /// 创建网卡的信息
fn create_tun(&self, _info: DeviceInfo) {} fn create_tun(&self, _info: DeviceInfo) {}
/// 连接 /// 连接
+1
View File
@@ -307,6 +307,7 @@ impl<Call: VntCallback> ServerPacketHandler<Call> {
guard.push((dest, mask)); guard.push((dest, mask));
} }
} }
self.callback.success();
} }
self.set_device_info_list(response.device_info_list, response.epoch as _); self.set_device_info_list(response.device_info_list, response.epoch as _);
} }