Changed ping logic to eliminate a rare panic under heavy load (fixes #120).
This commit is contained in:
parent
c78770f763
commit
4921127372
1 changed files with 7 additions and 5 deletions
|
@ -69,12 +69,14 @@ where
|
||||||
}
|
}
|
||||||
|
|
||||||
fn send_ping(&mut self) -> error::Result<()> {
|
fn send_ping(&mut self) -> error::Result<()> {
|
||||||
self.last_ping_sent = Instant::now();
|
let last_ping_data = format!("{}", Local::now().timestamp());
|
||||||
self.last_ping_data = format!("{}", Local::now().timestamp());
|
let data = last_ping_data.clone();
|
||||||
let data = self.last_ping_data.clone();
|
|
||||||
let result = self.start_send(Command::PING(data, None).into())?;
|
let result = self.start_send(Command::PING(data, None).into())?;
|
||||||
assert!(result.is_ready());
|
if let AsyncSink::Ready = result {
|
||||||
self.poll_complete()?;
|
self.poll_complete()?;
|
||||||
|
self.last_ping_sent = Instant::now();
|
||||||
|
self.last_ping_data = last_ping_data;
|
||||||
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue