Skip to content
Permalink
Browse files

Avoid error_code virtual dispatch

We're using a header-only version of error_code, which generates error messages through virtual dispatch overrides (on error_category::message) and on Windows is only supposed to work from inside a single compilation unit.
  • Loading branch information...
ArtemGr committed Jul 4, 2019
1 parent 46f4d91 commit e5483680bd79ec966fbf254a004d6ee337f48cf4
Showing with 5 additions and 2 deletions.
  1. +1 −0 .gitignore
  2. +4 −2 mm2src/common/dht.cc
@@ -285,6 +285,7 @@ iguana/exchanges/manychains
/mm2src/peers/.vscode/tasks.json
/.vscode/settings.json
/.vscode/tasks.json
/.vscode/c_cpp_properties.json

# IDE artefacts
/.vscode/ipch
@@ -83,7 +83,8 @@ extern "C" void dht_load_state (dugout_t* dugout, char const* dht_state, int32_t
int rc = lt::bdecode (dht_state, dht_state + dht_state_len, en, ec);
if (rc) {
std::ostringstream ss;
ss << "Can't bdecode the DHT state: " << ec.message();
ss << "Can't bdecode the DHT state";
// NB: Trying not to use error_code from different compilation units // << ec.message();
throw std::runtime_error (ss.str());
}
dugout->session->load_state (en, lt::session::save_dht_state);
@@ -329,7 +330,8 @@ extern "C" void lt_send_udp (dugout_t* dugout, char const* ip, uint16_t port, ui
lt::address addr = lt::make_address (ip, ec);
if (ec) {
std::ostringstream ss;
ss << "make_address error: " << ec;
ss << "make_address error";
// NB: Trying not to use error_code from different compilation units // << ec.message();
dugout->err = strdup (ss.str().c_str());
return;
}

0 comments on commit e548368

Please sign in to comment.
You can’t perform that action at this time.