From f68aa11de1096affe4ff8b1104ae74200b615c8c Mon Sep 17 00:00:00 2001 From: Jacob Heun Date: Wed, 29 Aug 2018 16:24:52 +0200 Subject: [PATCH] fix: make findProviders treat timeout the same as findPeer --- src/index.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/index.js b/src/index.js index 551de6ca..8234dc3c 100644 --- a/src/index.js +++ b/src/index.js @@ -433,6 +433,15 @@ class KadDHT { * @returns {void} */ findProviders (key, timeout, callback) { + if (typeof timeout === 'function') { + callback = timeout + timeout = null + } + + if (timeout == null) { + timeout = c.minute + } + this._log('findProviders %s', key.toBaseEncodedString()) this._findNProviders(key, timeout, c.K, callback) }