Merge pull request #6736

05ad4fa39 epee: further defending against exceptions in command handlers (moneromooo-monero)
This commit is contained in:
Alexander Blair 2020-08-16 12:56:35 -07:00
commit 43a4fd9e16
No known key found for this signature in database
GPG Key ID: C64552D877C32479
1 changed files with 7 additions and 0 deletions

View File

@ -291,6 +291,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) \
@ -336,7 +337,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 */ \
} \
}
}
}