mirror of
https://github.com/dndx/phantun.git
synced 2025-01-19 06:19:30 +08:00
fix(fake-tcp) remove unneeded State::Closed
as it is not in a
reachable code path
This commit is contained in:
parent
521a3f1a01
commit
33e510e7ba
@ -57,7 +57,6 @@ pub enum State {
|
|||||||
SynSent,
|
SynSent,
|
||||||
SynReceived,
|
SynReceived,
|
||||||
Established,
|
Established,
|
||||||
Closed,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct Socket {
|
pub struct Socket {
|
||||||
@ -116,12 +115,10 @@ impl Socket {
|
|||||||
|
|
||||||
tokio::select! {
|
tokio::select! {
|
||||||
res = self.tun.send(&buf) => {
|
res = self.tun.send(&buf) => {
|
||||||
res.unwrap();
|
res.ok().and(Some(()))
|
||||||
Some(())
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
State::Closed => None,
|
|
||||||
_ => unreachable!(),
|
_ => unreachable!(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -148,7 +145,6 @@ impl Socket {
|
|||||||
Some(payload.len())
|
Some(payload.len())
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
State::Closed => None,
|
|
||||||
_ => unreachable!(),
|
_ => unreachable!(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -252,8 +248,6 @@ impl Socket {
|
|||||||
|
|
||||||
impl Drop for Socket {
|
impl Drop for Socket {
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
self.state = State::Closed;
|
|
||||||
|
|
||||||
let tuple = AddrTuple::new(self.local_addr, self.remote_addr);
|
let tuple = AddrTuple::new(self.local_addr, self.remote_addr);
|
||||||
// dissociates ourself from the dispatch map
|
// dissociates ourself from the dispatch map
|
||||||
assert!(self.shared.tuples.write().unwrap().remove(&tuple).is_some());
|
assert!(self.shared.tuples.write().unwrap().remove(&tuple).is_some());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user