Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Remove request ID from the new protocol #5049

Merged
merged 2 commits into from
Mar 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions client/network/src/protocol/block_requests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ impl Config {
let mut v = Vec::new();
v.extend_from_slice(b"/");
v.extend_from_slice(id.as_bytes());
v.extend_from_slice(b"/sync/1");
v.extend_from_slice(b"/sync/2");
self.protocol = v.into();
self
}
Expand Down Expand Up @@ -146,8 +146,7 @@ where
, request: &api::v1::BlockRequest
) -> Result<api::v1::BlockResponse, Error>
{
log::trace!("block request {} from peer {}: from block {:?} to block {:?}, max blocks {:?}",
request.id,
log::trace!("block request from peer {}: from block {:?} to block {:?}, max blocks {:?}",
peer,
request.from_block,
request.to_block,
Expand Down Expand Up @@ -242,7 +241,7 @@ where
}
}

Ok(api::v1::BlockResponse { id: request.id, blocks })
Ok(api::v1::BlockResponse { blocks })
}
}

Expand Down Expand Up @@ -274,10 +273,10 @@ where
fn inject_node_event(&mut self, peer: PeerId, Request(request, mut stream): Request<NegotiatedSubstream>) {
match self.on_block_request(&peer, &request) {
Ok(res) => {
log::trace!("enqueueing block response {} for peer {} with {} blocks", res.id, peer, res.blocks.len());
log::trace!("enqueueing block response for peer {} with {} blocks", peer, res.blocks.len());
let mut data = Vec::with_capacity(res.encoded_len());
if let Err(e) = res.encode(&mut data) {
log::debug!("error encoding block response {} for peer {}: {}", res.id, peer, e)
log::debug!("error encoding block response for peer {}: {}", peer, e)
} else {
let future = async move {
if let Err(e) = write_one(&mut stream, data).await {
Expand All @@ -287,7 +286,7 @@ where
self.outgoing.push(future.boxed())
}
}
Err(e) => log::debug!("error handling block request {} from peer {}: {}", request.id, peer, e)
Err(e) => log::debug!("error handling block request from peer {}: {}", peer, e)
}
}

Expand Down
Loading