Merge pull request #121 from aatxe/better-ping-logic

Finalize 0.13.4 release.
This commit is contained in:
Aaron Weiss 2018-02-23 21:15:34 +01:00 committed by GitHub
commit 0b2e2539c9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 6 deletions

View file

@ -1,6 +1,6 @@
[package] [package]
name = "irc" name = "irc"
version = "0.13.3" version = "0.13.4"
description = "A simple, thread-safe, and async-friendly library for IRC clients." description = "A simple, thread-safe, and async-friendly library for IRC clients."
authors = ["Aaron Weiss <awe@pdgn.co>"] authors = ["Aaron Weiss <awe@pdgn.co>"]
license = "MPL-2.0" license = "MPL-2.0"

View file

@ -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(())
} }