fix: peer connect panic on log (#2272)

This commit is contained in:
Gary Yu 2019-01-02 09:54:17 +08:00 committed by GitHub
parent daa712ae99
commit 7e8296dce0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -97,14 +97,14 @@ impl Peer {
hs: &Handshake,
na: Arc<dyn NetAdapter>,
) -> Result<Peer, Error> {
debug!("connect: handshaking with {:?}", conn.peer_addr().unwrap());
debug!("connect: handshaking with {:?}", conn.peer_addr());
let info = hs.initiate(capab, total_difficulty, self_addr, conn);
match info {
Ok(peer_info) => Ok(Peer::new(peer_info, na)),
Err(e) => {
debug!(
"connect: handshaking with {:?} failed with error: {:?}",
conn.peer_addr().unwrap(),
conn.peer_addr(),
e
);
if let Err(e) = conn.shutdown(Shutdown::Both) {