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.
This commit is contained in:
Steven Allen 2020-01-23 09:04:13 -08:00
parent 995fee9e53
commit 3f8b219554

View File

@ -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.