Fix logging in RPC

Summary: Starting memgraph with logging verbosity level 12 would crash memgraph, because extended and regular callbacks were not properly differentiated in logging.

Reviewers: mferencevic

Reviewed By: mferencevic

Subscribers: pullbot

Differential Revision: https://phabricator.memgraph.io/D1747
This commit is contained in:
Marin Tomic 2018-11-23 13:22:28 +01:00
parent b647e3f8b8
commit 11bf7d3b31

View File

@ -49,10 +49,12 @@ void Session::Execute() {
// server was started so those two maps will never be updated when we `find`
// over them.
auto it = server_->callbacks_.find(request.getTypeId());
auto extended_it = server_->extended_callbacks_.end();
if (it == server_->callbacks_.end()) {
// We couldn't find a regular callback to call, try to find an extended
// callback to call.
auto extended_it = server_->extended_callbacks_.find(request.getTypeId());
extended_it = server_->extended_callbacks_.find(request.getTypeId());
if (extended_it == server_->extended_callbacks_.end()) {
// Throw exception to close the socket and cleanup the session.
throw SessionException(
@ -83,7 +85,10 @@ void Session::Execute() {
throw SessionException("Couldn't send response data!");
}
VLOG(12) << "[RpcServer] sent " << it->second.res_type.name;
VLOG(12) << "[RpcServer] sent "
<< (it != server_->callbacks_.end()
? it->second.res_type.name
: extended_it->second.res_type.name);
}
} // namespace communication::rpc