From 6d238836ad14546f21f99c105669b095e0234c7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrien=20B=C3=A9raud?= <adrien.beraud@savoirfairelinux.com> Date: Thu, 16 Nov 2017 23:31:22 +0100 Subject: [PATCH] dht: return empty search on error --- src/dht.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/dht.cpp b/src/dht.cpp index 6dec3b26..7bd72f92 100644 --- a/src/dht.cpp +++ b/src/dht.cpp @@ -672,8 +672,10 @@ Dht::search(const InfoHash& id, sa_family_t af, GetCallback gcb, QueryCallback q break; } } - if (not sr) - throw DhtException("Can't create search"); + if (not sr) { + DHT_LOG.e(id, "[search %s IPv%c] maximum number of searches reached !", id.toString().c_str(), (af == AF_INET) ? '4' : '6'); + return {}; + } } sr->af = af; sr->tid = search_id++; -- GitLab