Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Log which peer gives unexpected length messages #5097

Merged
merged 2 commits into from
Aug 9, 2018

Conversation

ScottSallinen
Copy link
Contributor

This allows a quicker understanding of which peer is misbehaving, allowing faster turnaround time to blocking bad peers.

This allows a quicker understanding of which peer is misbehaving, allowing faster turnaround time to blocking bad peers.
@@ -2122,7 +2122,7 @@ namespace eosio {
auto index = conn->pending_message_buffer.read_index();
conn->pending_message_buffer.peek(&message_length, sizeof(message_length), index);
if(message_length > def_send_buffer_size*2 || message_length == 0) {
elog("incoming message length unexpected (${i})", ("i", message_length));
elog("incoming message length unexpected (${i}), from ${p}", ("i", message_length)("p",boost::lexical_cast<std::string>(conn->socket->remote_endpoint())));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can throw an exception which will be caught below and report std::exception below. Pass boost::system::error_code ec; to remote_endpoint(ec); to avoid exception.

@ScottSallinen
Copy link
Contributor Author

Updated -- I'm not sure that it can cause an exception there without excepting on the connection close, but good to squash it anyways I suppose.

@heifner heifner merged commit 1b6e5ea into EOSIO:develop Aug 9, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants