# HG changeset patch # User Matt Johnston # Date 1488384380 -28800 # Node ID 5c2b0d47bb831a2c929a8ca5e6c110575f083f69 # Parent 5fc41e0833b4f1bb39a5fbda07fdec82f718f903 Response has epoch_tag and params diff -r 5fc41e0833b4 -r 5c2b0d47bb83 rust/src/paramwaiter.rs --- a/rust/src/paramwaiter.rs Thu Mar 02 00:06:03 2017 +0800 +++ b/rust/src/paramwaiter.rs Thu Mar 02 00:06:20 2017 +0800 @@ -9,6 +9,7 @@ use std::rc::Rc; use std::sync::{Arc,Mutex}; use std::error::Error; +use std::cell::Cell; use tokio_core::reactor::Interval; use tokio_core::reactor::Handle; @@ -19,6 +20,12 @@ use types::*; use ::Config; +#[derive(Deserialize, Debug)] +struct Response { + epoch_tag: String, + params: Params, +} + #[derive(Clone)] pub struct ParamWaiter { limitlog: NotTooOften, @@ -54,7 +61,13 @@ let text = String::from_utf8_lossy(buf).to_string(); let resp = req.response_code()?; match resp { - 200 => Ok(Some(serde_json::from_str(&text)?)), // new params + 200 => { + // new params + let r: Response = serde_json::from_str(&text)?; + // XXX + //self.epoch_tag = r.epoch_tag; + Ok(Some(r.params)) + } 304 => Ok(None), // unmodified (long polling timeout at the server) _ => { Err(TemplogError::new(&format!("Wrong server response code {}: {}", resp, text)))