Skip to content

Commit

Permalink
Merge branch 'master' into remove-Algorithm-from_str
Browse files Browse the repository at this point in the history
  • Loading branch information
bluejekyll committed Oct 25, 2017
2 parents 5956efa + 0bb0b2c commit aec6258
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 11 deletions.
1 change: 0 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion proto/Cargo.toml
Expand Up @@ -47,7 +47,6 @@ name = "trust_dns_proto"
path = "src/lib.rs"

[dependencies]
chrono = "^0.4"
data-encoding = { version = "^1.2.0", optional = true }
error-chain = "0.1.12"
futures = "^0.1.6"
Expand Down
14 changes: 7 additions & 7 deletions proto/src/dns_handle.rs
Expand Up @@ -8,9 +8,8 @@
use std::collections::{HashMap, HashSet};
use std::io;
use std::marker::PhantomData;
use std::time::Duration;
use std::time::{Duration, SystemTime, UNIX_EPOCH};

use chrono::Utc;
use futures::{Async, Complete, Future, Poll, task};
use futures::IntoFuture;
use futures::stream::{Peekable, Fuse as StreamFuse, Stream};
Expand Down Expand Up @@ -268,14 +267,15 @@ where
let query_id = query_id.expect("query_id should have been set above");
message.set_id(query_id);

let now = SystemTime::now().duration_since(UNIX_EPOCH)
.map_err(|_| "Current time is before the Unix epoch.".into())?
.as_secs();
let now = now as u32; // XXX: truncates u64 to u32.

// update messages need to be signed.
if let OpCode::Update = message.op_code() {
if let Some(ref signer) = self.signer {
if let Err(e) = message.finalize(
signer,
Utc::now().timestamp() as u32,
)
{
if let Err(e) = message.finalize(signer, now) {
warn!("could not sign message: {}", e);
complete.send(Err(e.into())).expect(
"error notifying wait, possible future leak",
Expand Down
3 changes: 1 addition & 2 deletions proto/src/lib.rs
Expand Up @@ -10,7 +10,6 @@

//! TRust-DNS Protocol library

extern crate chrono;
#[cfg(any(feature = "openssl", feature = "ring"))]
extern crate data_encoding;
#[macro_use]
Expand Down Expand Up @@ -113,4 +112,4 @@ where
)
})
}
}
}

0 comments on commit aec6258

Please sign in to comment.