Tweak debug output in PeerConnector handshake.
This commit is contained in:
parent
fb2b502eb9
commit
f284f6d6cf
|
@ -89,13 +89,14 @@ where
|
|||
let user_agent = self.config.user_agent.clone();
|
||||
|
||||
let fut = async move {
|
||||
info!("beginning connection");
|
||||
info!("connecting to remote peer");
|
||||
debug!("opening tcp stream");
|
||||
|
||||
let mut stream = Framed::new(
|
||||
TcpStream::connect(addr).await?,
|
||||
Codec::builder().for_network(network).finish(),
|
||||
);
|
||||
|
||||
// XXX construct the Version message from a config
|
||||
let version = Message::Version {
|
||||
version: constants::CURRENT_VERSION,
|
||||
services: PeerServices::NODE_NETWORK,
|
||||
|
@ -113,24 +114,38 @@ where
|
|||
relay: false,
|
||||
};
|
||||
|
||||
debug!(?version, "sending initial version message");
|
||||
|
||||
stream.send(version).await?;
|
||||
|
||||
let _remote_version = stream
|
||||
let remote_version = stream
|
||||
.next()
|
||||
.await
|
||||
.ok_or_else(|| format_err!("stream closed during handshake"))??;
|
||||
|
||||
debug!(
|
||||
?remote_version,
|
||||
"got remote peer's version message, sending verack"
|
||||
);
|
||||
|
||||
stream.send(Message::Verack).await?;
|
||||
let _remote_verack = stream
|
||||
let remote_verack = stream
|
||||
.next()
|
||||
.await
|
||||
.ok_or_else(|| format_err!("stream closed during handshake"))??;
|
||||
|
||||
debug!(?remote_verack, "got remote peer's verack");
|
||||
|
||||
// XXX here is where we would set the version to the minimum of the
|
||||
// two versions, etc. -- actually is it possible to edit the `Codec`
|
||||
// after using it to make a framed adapter?
|
||||
|
||||
// Construct a PeerClient, PeerServer pair
|
||||
// XXX do we want to use the random nonces to detect
|
||||
// self-connections or do a different mechanism? if we use the
|
||||
// nonces for their intended purpose we need communication between
|
||||
// PeerConnector and PeerListener.
|
||||
|
||||
debug!("constructing PeerClient, spawning PeerServer");
|
||||
|
||||
let (tx, rx) = mpsc::channel(0);
|
||||
let slot = ErrorSlot::default();
|
||||
|
|
Loading…
Reference in New Issue