@@ -44,14 +44,21 @@ var log = logging.Logger("bitswap-client")
44
44
// bitswap instances
45
45
type Option func (* Client )
46
46
47
- // ProviderSearchDelay overwrites the global provider search delay
47
+ // ProviderSearchDelay sets the initial dely before triggering a provider
48
+ // search to find more peers and broadcast the want list. It also partially
49
+ // controls re-broadcasts delay when the session idles (does not receive any
50
+ // blocks), but these have back-off logic to increase the interval. See
51
+ // [defaults.ProvSearchDelay] for the default.
48
52
func ProviderSearchDelay (newProvSearchDelay time.Duration ) Option {
49
53
return func (bs * Client ) {
50
54
bs .provSearchDelay = newProvSearchDelay
51
55
}
52
56
}
53
57
54
- // RebroadcastDelay overwrites the global provider rebroadcast delay
58
+ // RebroadcastDelay sets a custom delay for periodic search of a random want.
59
+ // When the value ellapses, a random CID from the wantlist is chosen and the
60
+ // client attempts to find more peers for it and sends them the single want.
61
+ // [defaults.RebroadcastDelay] for the default.
55
62
func RebroadcastDelay (newRebroadcastDelay delay.D ) Option {
56
63
return func (bs * Client ) {
57
64
bs .rebroadcastDelay = newRebroadcastDelay
@@ -168,7 +175,7 @@ func New(parent context.Context, network bsnet.BitSwapNetwork, bstore blockstore
168
175
dupMetric : bmetrics .DupHist (ctx ),
169
176
allMetric : bmetrics .AllHist (ctx ),
170
177
provSearchDelay : defaults .ProvSearchDelay ,
171
- rebroadcastDelay : delay .Fixed (time . Minute ),
178
+ rebroadcastDelay : delay .Fixed (defaults . RebroadcastDelay ),
172
179
simulateDontHavesOnTimeout : true ,
173
180
}
174
181
0 commit comments