Skip to content

Commit

Permalink
Merge pull request #6737
Browse files Browse the repository at this point in the history
0325474 epee: further defending against exceptions in command handlers (moneromooo-monero)
  • Loading branch information
luigi1111 committed Aug 3, 2020
2 parents 9006119 + 0325474 commit 7bd1ed0
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions contrib/epee/include/storages/levin_abstract_invoke2.h
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,7 @@ namespace epee
#define BEGIN_INVOKE_MAP2(owner_type) \
template <class t_context> int handle_invoke_map(bool is_notify, int command, const epee::span<const uint8_t> in_buff, std::string& buff_out, t_context& context, bool& handled) \
{ \
try { \
typedef owner_type internal_owner_type_name;

#define HANDLE_INVOKE2(command_id, func, type_name_in, typename_out) \
Expand Down Expand Up @@ -335,7 +336,13 @@ namespace epee
LOG_ERROR("Unknown command:" << command); \
on_levin_traffic(context, false, false, true, in_buff.size(), "invalid-command"); \
return LEVIN_ERROR_CONNECTION_HANDLER_NOT_DEFINED; \
} \
catch (const std::exception &e) { \
MERROR("Error in handle_invoke_map: " << e.what()); \
return LEVIN_ERROR_CONNECTION_TIMEDOUT; /* seems kinda appropriate */ \
} \
}

}
}

0 comments on commit 7bd1ed0

Please sign in to comment.