ws-rs update

This commit is contained in:
Tomusdrw
2016-08-08 17:03:25 +02:00
committed by Tomasz Drwięga
parent 4f32a9ccc1
commit 74e66c3f0e
4 changed files with 81 additions and 38 deletions

View File

@@ -15,7 +15,7 @@ rand = "0.3.14"
jsonrpc-core = "2.0"
log = "0.3"
env_logger = "0.3"
ws = { git = "https://github.com/ethcore/ws-rs.git", branch = "stable" }
ws = { git = "https://github.com/ethcore/ws-rs.git", branch = "mio-upstream-stable" }
ethcore-util = { path = "../util" }
ethcore-io = { path = "../util/io" }
ethcore-rpc = { path = "../rpc" }

View File

@@ -46,7 +46,7 @@ impl TimeProvider for DefaultTimeProvider {
}
/// No of seconds the hash is valid
const TIME_THRESHOLD: u64 = 2;
const TIME_THRESHOLD: u64 = 7;
const TOKEN_LENGTH: usize = 16;
/// Manages authorization codes for `SignerUIs`
@@ -102,7 +102,7 @@ impl<T: TimeProvider> AuthCodes<T> {
let now = self.now.now();
// check time
if time >= now + TIME_THRESHOLD || time <= now - TIME_THRESHOLD {
warn!(target: "signer", "Received old authentication request.");
warn!(target: "signer", "Received old authentication request. ({} vs {})", now, time);
return false;
}

View File

@@ -146,7 +146,9 @@ impl ws::Handler for Session {
fn on_message(&mut self, msg: ws::Message) -> ws::Result<()> {
let req = try!(msg.as_text());
match self.handler.handle_request(req) {
Some(res) => self.out.send(res),
Some(res) => {
self.out.send(res)
},
None => Ok(()),
}
}