swarm/network/stream: rename close channel to quit

This commit is contained in:
Janos Guljas 2019-02-19 14:59:07 +01:00
parent 3df5784076
commit 7579260cc0

View file

@ -95,7 +95,7 @@ type Registry struct {
spec *protocols.Spec //this protocol's spec spec *protocols.Spec //this protocol's spec
balance protocols.Balance //implements protocols.Balance, for accounting balance protocols.Balance //implements protocols.Balance, for accounting
prices protocols.Prices //implements protocols.Prices, provides prices to accounting prices protocols.Prices //implements protocols.Prices, provides prices to accounting
close chan struct{} // terminates registry goroutines quit chan struct{} // terminates registry goroutines
} }
// RegistryOptions holds optional values for NewRegistry constructor. // RegistryOptions holds optional values for NewRegistry constructor.
@ -118,7 +118,7 @@ func NewRegistry(localID enode.ID, delivery *Delivery, syncChunkStore storage.Sy
// check if retrieval has been disabled // check if retrieval has been disabled
retrieval := options.Retrieval != RetrievalDisabled retrieval := options.Retrieval != RetrievalDisabled
closeChan := make(chan struct{}) quit := make(chan struct{})
streamer := &Registry{ streamer := &Registry{
addr: localID, addr: localID,
@ -131,7 +131,7 @@ func NewRegistry(localID enode.ID, delivery *Delivery, syncChunkStore storage.Sy
autoRetrieval: retrieval, autoRetrieval: retrieval,
maxPeerServers: options.MaxPeerServers, maxPeerServers: options.MaxPeerServers,
balance: balance, balance: balance,
close: closeChan, quit: quit,
} }
streamer.setupSpec() streamer.setupSpec()
@ -184,7 +184,7 @@ func NewRegistry(localID enode.ID, delivery *Delivery, syncChunkStore storage.Sy
default: default:
} }
out <- i out <- i
case <-closeChan: case <-quit:
return return
} }
} }
@ -238,7 +238,7 @@ func NewRegistry(localID enode.ID, delivery *Delivery, syncChunkStore storage.Sy
<-timer.C <-timer.C
} }
timer.Reset(options.SyncUpdateDelay) timer.Reset(options.SyncUpdateDelay)
case <-closeChan: case <-quit:
break loop break loop
} }
} }
@ -413,7 +413,7 @@ func (r *Registry) Close() error {
// change from Kademlia that were initiated in NewRegistry constructor. // change from Kademlia that were initiated in NewRegistry constructor.
r.delivery.kad.CloseNeighbourhoodDepthC() r.delivery.kad.CloseNeighbourhoodDepthC()
r.delivery.kad.CloseAddrCountC() r.delivery.kad.CloseAddrCountC()
close(r.close) close(r.quit)
return r.intervalsStore.Close() return r.intervalsStore.Close()
} }