Skip to content

Commit

Permalink
Adding unhandled case for message_visitor
Browse files Browse the repository at this point in the history
  • Loading branch information
clemahieu committed May 5, 2022
1 parent 920d73a commit 2ae1f53
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 52 deletions.
56 changes: 45 additions & 11 deletions nano/node/common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -497,17 +497,51 @@ class node_id_handshake final : public message
class message_visitor
{
public:
virtual void keepalive (nano::keepalive const &) = 0;
virtual void publish (nano::publish const &) = 0;
virtual void confirm_req (nano::confirm_req const &) = 0;
virtual void confirm_ack (nano::confirm_ack const &) = 0;
virtual void bulk_pull (nano::bulk_pull const &) = 0;
virtual void bulk_pull_account (nano::bulk_pull_account const &) = 0;
virtual void bulk_push (nano::bulk_push const &) = 0;
virtual void frontier_req (nano::frontier_req const &) = 0;
virtual void node_id_handshake (nano::node_id_handshake const &) = 0;
virtual void telemetry_req (nano::telemetry_req const &) = 0;
virtual void telemetry_ack (nano::telemetry_ack const &) = 0;
virtual void keepalive (nano::keepalive const & message)
{
unhandled (message);
};
virtual void publish (nano::publish const & message)
{
unhandled (message);
}
virtual void confirm_req (nano::confirm_req const & message)
{
unhandled (message);
}
virtual void confirm_ack (nano::confirm_ack const & message)
{
unhandled (message);
}
virtual void bulk_pull (nano::bulk_pull const & message)
{
unhandled (message);
}
virtual void bulk_pull_account (nano::bulk_pull_account const & message)
{
unhandled (message);
}
virtual void bulk_push (nano::bulk_push const & message)
{
unhandled (message);
}
virtual void frontier_req (nano::frontier_req const & message)
{
unhandled (message);
}
virtual void node_id_handshake (nano::node_id_handshake const & message)
{
unhandled (message);
}
virtual void telemetry_req (nano::telemetry_req const & message)
{
unhandled (message);
}
virtual void telemetry_ack (nano::telemetry_ack const & message)
{
unhandled (message);
}
virtual void unhandled (nano::message const &) { };
virtual ~message_visitor ();
};

Expand Down
42 changes: 1 addition & 41 deletions nano/node/transport/inproc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,47 +41,7 @@ class message_visitor_inbound : public nano::message_visitor
// the channel to reply to, if a reply is generated
std::shared_ptr<nano::transport::inproc::channel> channel;

void keepalive (nano::keepalive const & message)
{
inbound (message, channel);
}
void publish (nano::publish const & message)
{
inbound (message, channel);
}
void confirm_req (nano::confirm_req const & message)
{
inbound (message, channel);
}
void confirm_ack (nano::confirm_ack const & message)
{
inbound (message, channel);
}
void bulk_pull (nano::bulk_pull const & message)
{
inbound (message, channel);
}
void bulk_pull_account (nano::bulk_pull_account const & message)
{
inbound (message, channel);
}
void bulk_push (nano::bulk_push const & message)
{
inbound (message, channel);
}
void frontier_req (nano::frontier_req const & message)
{
inbound (message, channel);
}
void node_id_handshake (nano::node_id_handshake const & message)
{
inbound (message, channel);
}
void telemetry_req (nano::telemetry_req const & message)
{
inbound (message, channel);
}
void telemetry_ack (nano::telemetry_ack const & message)
void unhandled (nano::message const & message) override
{
inbound (message, channel);
}
Expand Down

0 comments on commit 2ae1f53

Please sign in to comment.