remove unused expired value from Handshake (#9732)
This commit is contained in:
parent
fa2f99641f
commit
581cd97ba1
@ -69,8 +69,6 @@ pub struct Handshake {
|
||||
pub auth_cipher: Bytes,
|
||||
/// A copy of received encrypted ack packet
|
||||
pub ack_cipher: Bytes,
|
||||
/// This Handshake is marked for deletion flag
|
||||
pub expired: bool,
|
||||
}
|
||||
|
||||
const V4_AUTH_PACKET_SIZE: usize = 307;
|
||||
@ -95,15 +93,9 @@ impl Handshake {
|
||||
remote_version: PROTOCOL_VERSION,
|
||||
auth_cipher: Bytes::new(),
|
||||
ack_cipher: Bytes::new(),
|
||||
expired: false,
|
||||
})
|
||||
}
|
||||
|
||||
/// Check if this handshake is expired.
|
||||
pub fn expired(&self) -> bool {
|
||||
self.expired
|
||||
}
|
||||
|
||||
/// Start a handshake
|
||||
pub fn start<Message>(&mut self, io: &IoContext<Message>, host: &HostInfo, originated: bool) -> Result<(), Error> where Message: Send + Clone+ Sync + 'static {
|
||||
self.originated = originated;
|
||||
@ -125,7 +117,6 @@ impl Handshake {
|
||||
|
||||
/// Readable IO handler. Drives the state change.
|
||||
pub fn readable<Message>(&mut self, io: &IoContext<Message>, host: &HostInfo) -> Result<(), Error> where Message: Send + Clone + Sync + 'static {
|
||||
if !self.expired() {
|
||||
while let Some(data) = self.connection.readable()? {
|
||||
match self.state {
|
||||
HandshakeState::New => {},
|
||||
@ -148,15 +139,12 @@ impl Handshake {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Writable IO handler.
|
||||
pub fn writable<Message>(&mut self, io: &IoContext<Message>) -> Result<(), Error> where Message: Send + Clone + Sync + 'static {
|
||||
if !self.expired() {
|
||||
self.connection.writable(io)?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
@ -166,10 +166,7 @@ impl Session {
|
||||
|
||||
/// Check if this session is expired.
|
||||
pub fn expired(&self) -> bool {
|
||||
match self.state {
|
||||
State::Handshake(ref h) => self.expired || h.expired(),
|
||||
_ => self.expired,
|
||||
}
|
||||
self.expired
|
||||
}
|
||||
|
||||
/// Check if this session is over and there is nothing to be sent.
|
||||
|
Loading…
Reference in New Issue
Block a user