aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorluigi1111 <luigi1111w@gmail.com>2020-08-03 08:45:47 -0500
committerluigi1111 <luigi1111w@gmail.com>2020-08-03 08:45:47 -0500
commit7bd1ed03dd29d1f194503b6fdce6588306328b72 (patch)
tree12b7a2a6cc17b63b657adfdfd87dc9ec5e8ee213
parentMerge pull request #6734 (diff)
parentepee: further defending against exceptions in command handlers (diff)
downloadmonero-7bd1ed03dd29d1f194503b6fdce6588306328b72.tar.xz
Merge pull request #6737v0.16.0.3
0325474 epee: further defending against exceptions in command handlers (moneromooo-monero)
-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 de8107781..e9625f0ce 100644
--- a/contrib/epee/include/storages/levin_abstract_invoke2.h
+++ b/contrib/epee/include/storages/levin_abstract_invoke2.h
@@ -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) \
@@ -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 */ \
+ } \
}
+
}
}