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
balance protocols.Balance //implements protocols.Balance, for 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.
@ -118,7 +118,7 @@ func NewRegistry(localID enode.ID, delivery *Delivery, syncChunkStore storage.Sy
// check if retrieval has been disabled
retrieval := options.Retrieval != RetrievalDisabled
closeChan := make(chan struct{})
quit := make(chan struct{})
streamer := &Registry{
addr: localID,
@ -131,7 +131,7 @@ func NewRegistry(localID enode.ID, delivery *Delivery, syncChunkStore storage.Sy
autoRetrieval: retrieval,
maxPeerServers: options.MaxPeerServers,
balance: balance,
close: closeChan,
quit: quit,
}
streamer.setupSpec()
@ -184,7 +184,7 @@ func NewRegistry(localID enode.ID, delivery *Delivery, syncChunkStore storage.Sy
default:
}
out <- i
case <-closeChan:
case <-quit:
return
}
}
@ -238,7 +238,7 @@ func NewRegistry(localID enode.ID, delivery *Delivery, syncChunkStore storage.Sy
<-timer.C
}
timer.Reset(options.SyncUpdateDelay)
case <-closeChan:
case <-quit:
break loop
}
}
@ -413,7 +413,7 @@ func (r *Registry) Close() error {
// change from Kademlia that were initiated in NewRegistry constructor.
r.delivery.kad.CloseNeighbourhoodDepthC()
r.delivery.kad.CloseAddrCountC()
close(r.close)
close(r.quit)
return r.intervalsStore.Close()
}