From 3f8b219554ef609c1a85aceb9d6e959cb4f01209 Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Thu, 23 Jan 2020 09:04:13 -0800 Subject: [PATCH] feat: reduce stream idle timeout to 1m It's currently 10 minutes. This change will kill all inbound DHT streams that haven't been used in 1 minute. We keep streams around to avoid the cost of setting up new streams (the multistream overhead, mostly). However, each one of these takes at least one goroutine and some other state. Ideally, this will let us run multiple DHTs side-by-side without keeping one stream per peer per DHT open. --- dht_net.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dht_net.go b/dht_net.go index 10d4365..31775ae 100644 --- a/dht_net.go +++ b/dht_net.go @@ -23,7 +23,7 @@ import ( ) var dhtReadMessageTimeout = time.Minute -var dhtStreamIdleTimeout = 10 * time.Minute +var dhtStreamIdleTimeout = 1 * time.Minute var ErrReadTimeout = fmt.Errorf("timed out reading response") // The Protobuf writer performs multiple small writes when writing a message.