File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed
Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -80,13 +80,14 @@ func (dht *DHT) Close() error {
8080 return combineErrors (dht .WAN .Close (), dht .LAN .Close ())
8181}
8282
83- func (dht * DHT ) activeWAN () bool {
83+ // WANActive returns true when the WAN DHT is active (has peers).
84+ func (dht * DHT ) WANActive () bool {
8485 return dht .WAN .RoutingTable ().Size () > 0
8586}
8687
8788// Provide adds the given cid to the content routing system.
8889func (dht * DHT ) Provide (ctx context.Context , key cid.Cid , announce bool ) error {
89- if dht .activeWAN () {
90+ if dht .WANActive () {
9091 return dht .WAN .Provide (ctx , key , announce )
9192 }
9293 return dht .LAN .Provide (ctx , key , announce )
@@ -212,7 +213,7 @@ func (dht *DHT) Bootstrap(ctx context.Context) error {
212213
213214// PutValue adds value corresponding to given Key.
214215func (dht * DHT ) PutValue (ctx context.Context , key string , val []byte , opts ... routing.Option ) error {
215- if dht .activeWAN () {
216+ if dht .WANActive () {
216217 return dht .WAN .PutValue (ctx , key , val , opts ... )
217218 }
218219 return dht .LAN .PutValue (ctx , key , val , opts ... )
You can’t perform that action at this time.
0 commit comments