aboutsummaryrefslogtreecommitdiff
path: root/contrib/epee
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2020-08-02 00:21:20 +0000
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2020-08-02 00:22:47 +0000
commit05ad4fa39720958ec7dc46c746cb960ce49fe88e (patch)
tree44f52d670d50ed3c565ad8f4f6a14df6f02271d7 /contrib/epee
parentMerge pull request #6586 (diff)
downloadmonero-05ad4fa39720958ec7dc46c746cb960ce49fe88e.tar.xz
epee: further defending against exceptions in command handlers
Diffstat (limited to 'contrib/epee')
-rw-r--r--contrib/epee/include/storages/levin_abstract_invoke2.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/contrib/epee/include/storages/levin_abstract_invoke2.h b/contrib/epee/include/storages/levin_abstract_invoke2.h
index 4633fa546..cf1262486 100644
--- a/contrib/epee/include/storages/levin_abstract_invoke2.h
+++ b/contrib/epee/include/storages/levin_abstract_invoke2.h
@@ -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 */ \
+ } \
}
+
}
}