忽略跃点设置失败的异常
This commit is contained in:
@@ -96,7 +96,9 @@ impl Device {
|
|||||||
.map_err(|e| io::Error::new(e.kind(), format!("TAP_WIN_IOCTL_GET_MAC,err={:?}", e)))?;
|
.map_err(|e| io::Error::new(e.kind(), format!("TAP_WIN_IOCTL_GET_MAC,err={:?}", e)))?;
|
||||||
let index = ffi::luid_to_index(&luid).map(|index| index as u32)?;
|
let index = ffi::luid_to_index(&luid).map(|index| index as u32)?;
|
||||||
// 设置网卡跃点
|
// 设置网卡跃点
|
||||||
netsh::set_interface_metric(index, 0)?;
|
if let Err(e) = netsh::set_interface_metric(index, 0) {
|
||||||
|
log::warn!("{:?}",e);
|
||||||
|
}
|
||||||
let device = Self {
|
let device = Self {
|
||||||
handle,
|
handle,
|
||||||
index,
|
index,
|
||||||
|
|||||||
@@ -117,7 +117,9 @@ impl Device {
|
|||||||
win_tun.WintunGetAdapterLUID(adapter, &mut luid as *mut wintun_raw::NET_LUID);
|
win_tun.WintunGetAdapterLUID(adapter, &mut luid as *mut wintun_raw::NET_LUID);
|
||||||
let index = ffi::luid_to_index(&std::mem::transmute(luid)).map(|index| index as u32)?;
|
let index = ffi::luid_to_index(&std::mem::transmute(luid)).map(|index| index as u32)?;
|
||||||
// 设置网卡跃点
|
// 设置网卡跃点
|
||||||
netsh::set_interface_metric(index, 0)?;
|
if let Err(e) = netsh::set_interface_metric(index, 0) {
|
||||||
|
log::warn!("{:?}",e);
|
||||||
|
}
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
luid: std::mem::transmute(luid),
|
luid: std::mem::transmute(luid),
|
||||||
index,
|
index,
|
||||||
|
|||||||
Reference in New Issue
Block a user