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,
|
||||
SynReceived,
|
||||
Established,
|
||||
Closed,
|
||||
}
|
||||
|
||||
pub struct Socket {
|
||||
@ -116,12 +115,10 @@ impl Socket {
|
||||
|
||||
tokio::select! {
|
||||
res = self.tun.send(&buf) => {
|
||||
res.unwrap();
|
||||
Some(())
|
||||
res.ok().and(Some(()))
|
||||
},
|
||||
}
|
||||
}
|
||||
State::Closed => None,
|
||||
_ => unreachable!(),
|
||||
}
|
||||
}
|
||||
@ -148,7 +145,6 @@ impl Socket {
|
||||
Some(payload.len())
|
||||
})
|
||||
}
|
||||
State::Closed => None,
|
||||
_ => unreachable!(),
|
||||
}
|
||||
}
|
||||
@ -252,8 +248,6 @@ impl Socket {
|
||||
|
||||
impl Drop for Socket {
|
||||
fn drop(&mut self) {
|
||||
self.state = State::Closed;
|
||||
|
||||
let tuple = AddrTuple::new(self.local_addr, self.remote_addr);
|
||||
// dissociates ourself from the dispatch map
|
||||
assert!(self.shared.tuples.write().unwrap().remove(&tuple).is_some());
|
||||
|
Loading…
x
Reference in New Issue
Block a user