Remove Iron dependency and update hyper to version 0.12 (#1241)

* Remove Iron dependecy and update hyper to version 0.12 #876

* REMOVE ME

* Revert "REMOVE ME"

This reverts commit e9a976eee98a2d5a4dfae5d9e1e4f5ed640c05d3.

* Rebase and start updating libwallet

Libwallet doesn't compile yet.

* Wallet compiles

* Grin compiles

* No compilation errors in tests

* All tests pass

* Reeturn future from handler

* Refactoring

* Fix lifetime issue one more time

I have to force push to rollback all the work done in last 2 days

* Fix wallet send issue

* Clean up
This commit is contained in:
e-max
2018-08-01 11:44:07 +02:00
committed by Yeastplume
parent b040aaa434
commit 25e3d9e7d3
21 changed files with 1434 additions and 1252 deletions
+6 -13
View File
@@ -27,8 +27,10 @@ use util::LOGGER;
use peer::Peer;
use store::{PeerData, PeerStore, State};
use types::{Capabilities, ChainAdapter, Direction, Error, NetAdapter, P2PConfig, ReasonForBan,
TxHashSetRead, MAX_PEER_ADDRS};
use types::{
Capabilities, ChainAdapter, Direction, Error, NetAdapter, P2PConfig, ReasonForBan,
TxHashSetRead, MAX_PEER_ADDRS,
};
pub struct Peers {
pub adapter: Arc<ChainAdapter>,
@@ -615,17 +617,8 @@ impl ChainAdapter for Peers {
self.adapter.txhashset_receive_ready()
}
fn txhashset_write(
&self,
h: Hash,
txhashset_data: File,
peer_addr: SocketAddr,
) -> bool {
if !self.adapter.txhashset_write(
h,
txhashset_data,
peer_addr,
) {
fn txhashset_write(&self, h: Hash, txhashset_data: File, peer_addr: SocketAddr) -> bool {
if !self.adapter.txhashset_write(h, txhashset_data, peer_addr) {
debug!(
LOGGER,
"Received a bad txhashset data from {}, the peer will be banned", &peer_addr
+9 -12
View File
@@ -20,8 +20,10 @@ use std::sync::Arc;
use conn::{Message, MessageHandler, Response};
use core::core;
use core::core::hash::{Hash, Hashed};
use msg::{BanReason, GetPeerAddrs, Headers, Locator, PeerAddrs, Ping, Pong, SockAddr,
TxHashSetArchive, TxHashSetRequest, Type};
use msg::{
BanReason, GetPeerAddrs, Headers, Locator, PeerAddrs, Ping, Pong, SockAddr, TxHashSetArchive,
TxHashSetRequest, Type,
};
use rand::{self, Rng};
use types::{Error, NetAdapter};
use util::LOGGER;
@@ -241,21 +243,19 @@ impl MessageHandler for Protocol {
);
return Err(Error::BadMessage);
}
let mut tmp = env::temp_dir();
tmp.push("txhashset.zip");
let mut save_txhashset_to_file = |file| -> Result<(), Error> {
let mut save_txhashset_to_file = |file| -> Result<(), Error> {
let mut tmp_zip = File::create(file)?;
msg.copy_attachment(sm_arch.bytes as usize, &mut tmp_zip)?;
tmp_zip.sync_all()?;
Ok(())
};
if let Err(e) = save_txhashset_to_file(tmp.clone()){
if let Err(e) = save_txhashset_to_file(tmp.clone()) {
error!(
LOGGER,
"handle_payload: txhashset archive save to file fail. err={:?}",
e
"handle_payload: txhashset archive save to file fail. err={:?}", e
);
return Err(e);
}
@@ -267,11 +267,8 @@ impl MessageHandler for Protocol {
);
let tmp_zip = File::open(tmp)?;
let res = self.adapter.txhashset_write(
sm_arch.hash,
tmp_zip,
self.addr,
);
let res = self.adapter
.txhashset_write(sm_arch.hash, tmp_zip, self.addr);
debug!(
LOGGER,
+1 -6
View File
@@ -254,12 +254,7 @@ impl ChainAdapter for DummyAdapter {
false
}
fn txhashset_write(
&self,
_h: Hash,
_txhashset_data: File,
_peer_addr: SocketAddr,
) -> bool {
fn txhashset_write(&self, _h: Hash, _txhashset_data: File, _peer_addr: SocketAddr) -> bool {
false
}
}