Created
August 29, 2018 15:36
-
-
Save jkilpatr/2e6b33b810b852f8714c7765cff79440 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let res = stream.then(move |stream| { | |
let stream = stream.expect("Error attaching to full node socket"); | |
client::post(&endpoint) | |
.timeout(Duration::from_secs(8)) | |
.with_connection(Connection::from_stream(stream)) | |
.json(func_call) | |
.unwrap() | |
.send() | |
.then(move |response| { | |
trace!("Got response {:?}", response); | |
match response { | |
Ok(res) => res.json().then( | |
move |val: Result<Web3Response, JsonPayloadError>| match val { | |
Ok(val) => { | |
DAOManager::from_registry().do_send(CacheCallback { | |
id: target, | |
dao_address: dao_address.clone(), | |
response: val, | |
}); | |
Ok(()) | |
} | |
Err(e) => { | |
trace!("Got bad Web3Response {:?}", e); | |
return Ok(()); | |
} | |
}, | |
), | |
Err(e) => { | |
warn!("Got error from full node {:?}", e); | |
future::ok.into() | |
} | |
} | |
}) | |
}); | |
Arbiter::spawn(res); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment