Minor fixes

This commit is contained in:
arkpar 2016-01-14 16:56:59 +01:00
parent d971abf1da
commit db25f7e590
2 changed files with 10 additions and 2 deletions

View File

@ -444,6 +444,16 @@ impl From<H256> for Address {
} }
} }
} }
impl From<H256> for H64 {
fn from(value: H256) -> H64 {
unsafe {
let mut ret: H64 = ::std::mem::uninitialized();
::std::ptr::copy(value.as_ptr().offset(20), ret.as_mut_ptr(), 8);
ret
}
}
}
/* /*
impl<'_> From<&'_ H256> for Address { impl<'_> From<&'_ H256> for Address {
fn from(value: &'_ H256) -> Address { fn from(value: &'_ H256) -> Address {

View File

@ -355,7 +355,6 @@ impl<Message> Host<Message> where Message: Send {
let nonce = self.info.next_nonce(); let nonce = self.info.next_nonce();
match self.connections.insert_with(|token| ConnectionEntry::Handshake(Handshake::new(token, id, socket, &nonce).expect("Can't create handshake"))) { match self.connections.insert_with(|token| ConnectionEntry::Handshake(Handshake::new(token, id, socket, &nonce).expect("Can't create handshake"))) {
Some(token) => { Some(token) => {
warn!(target: "slab", "inserted {}", token.as_usize());
match self.connections.get_mut(token) { match self.connections.get_mut(token) {
Some(&mut ConnectionEntry::Handshake(ref mut h)) => { Some(&mut ConnectionEntry::Handshake(ref mut h)) => {
h.start(&self.info, true) h.start(&self.info, true)
@ -536,7 +535,6 @@ impl<Message> Host<Message> where Message: Send {
h.disconnected(&mut NetworkContext::new(io, p, Some(token), &mut self.connections, &mut self.timers), &token); h.disconnected(&mut NetworkContext::new(io, p, Some(token), &mut self.connections, &mut self.timers), &token);
} }
self.connections.remove(Token(token)); self.connections.remove(Token(token));
warn!(target: "slab", "removed {}", token);
} }
} }