Do not clear remote_last_ts in TcpSocket::set_timeout().
After this change, if an 1s timeout is set on a socket that received no packet for 2s, it will be instantly aborted, which seems more reasonable. Also, this makes the `self.remote_last_ts.is_none()` branch in TcpSocket::dispatch() actually behave as described.
This commit is contained in:
parent
f23bfe2014
commit
d7da46fd3b
|
@ -280,8 +280,7 @@ impl<'a> TcpSocket<'a> {
|
||||||
/// * After enabling [keep-alive](#method.set_keep_alive), the remote endpoint exceeds
|
/// * After enabling [keep-alive](#method.set_keep_alive), the remote endpoint exceeds
|
||||||
/// the specified duration between any two packets it sends.
|
/// the specified duration between any two packets it sends.
|
||||||
pub fn set_timeout(&mut self, duration: Option<u64>) {
|
pub fn set_timeout(&mut self, duration: Option<u64>) {
|
||||||
self.timeout = duration;
|
self.timeout = duration
|
||||||
self.remote_last_ts = None;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Return the keep-alive interval.
|
/// Return the keep-alive interval.
|
||||||
|
|
Loading…
Reference in New Issue