Skip to content

Commit

Permalink
going to test destructor fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Ubuntu committed Mar 6, 2024
1 parent bad5729 commit e831997
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/include/woofc-access.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ int WooFMsgRepair(char* woof_name, Dlist* holes);
/*
* 2 minute timeout
*/
#define WOOF_MSG_REQ_TIMEOUT (120000)
//#define WOOF_MSG_REQ_TIMEOUT (120000)
//#define WOOF_MSG_REQ_TIMEOUT (500)
//#define WOOF_MSG_REQ_TIMEOUT (10000)
#define WOOF_MSG_REQ_TIMEOUT (10000)

#define WOOF_MSG_THREADS (15)

Expand Down
10 changes: 9 additions & 1 deletion src/net/zmq/backend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

namespace cspot::zmq {
per_endpoint_data* backend::get_local_socket_for(const std::string& endpoint) {
auto& map_for_thread = m_per_thread_socks[std::this_thread::get_id()];

auto& map_for_thread = m_per_thread_socks[std::this_thread::get_id()];
auto it = map_for_thread.find(endpoint);
if (it == map_for_thread.end()) {
// Socket does not exist
Expand All @@ -19,6 +19,14 @@ per_endpoint_data* backend::get_local_socket_for(const std::string& endpoint) {
}
auto [i, ins] = map_for_thread.emplace(endpoint, std::move(*ep_data));
it = i;
} else {
map_for_thread.erase(endpoint); // should call destructor on server and poller
auto ep_data = cspot::zmq::per_endpoint_data::create(endpoint);
if (!ep_data) {
return nullptr;
}
auto [i, ins] = map_for_thread.emplace(endpoint, std::move(*ep_data));
it = i;
}

return &it->second;
Expand Down

0 comments on commit e831997

Please sign in to comment.