diff --git a/src/dht.cpp b/src/dht.cpp index 9622837103f726caeb2d926cf8e6908dbe305c5f..655240a20e9377f2e6eb9882d8c11d3d1da5793f 100644 --- a/src/dht.cpp +++ b/src/dht.cpp @@ -461,6 +461,17 @@ struct Dht::Search { std::map<size_t, LocalListener> listeners {}; size_t listener_token = 1; + ~Search() { + for (auto& get : callbacks) { + get.second.done_cb(false, {}); + get.second.done_cb = {}; + } + for (auto& put : announce) { + put.callback(false, {}); + put.callback = {}; + } + } + /** * @returns true if the node was not present and added to the search */