routing: fix vet error, ensure wait group in topologyClient isn't copied

This commit is contained in:
Olaoluwa Osuntokun 2017-06-25 13:48:47 +01:00
parent 5c45d52ab6
commit 9b9f419e51
No known key found for this signature in database
GPG Key ID: 9CC5B105D03521A2
2 changed files with 4 additions and 4 deletions

View File

@ -121,7 +121,7 @@ func (r *ChannelRouter) notifyTopologyChange(topologyDiff *TopologyChange) {
for _, client := range r.topologyClients {
client.wg.Add(1)
go func(c topologyClient) {
go func(c *topologyClient) {
defer c.wg.Done()
select {

View File

@ -181,7 +181,7 @@ type ChannelRouter struct {
// topologyClients maps a client's unique notification ID to a
// topologyClient client that contains its notification dispatch
// channel.
topologyClients map[uint64]topologyClient
topologyClients map[uint64]*topologyClient
// ntfnClientUpdates is a channel that's used to send new updates to
// topology notification clients to the ChannelRouter. Updates either
@ -213,7 +213,7 @@ func New(cfg Config) (*ChannelRouter, error) {
cfg: &cfg,
selfNode: selfNode,
networkUpdates: make(chan *routingMsg),
topologyClients: make(map[uint64]topologyClient),
topologyClients: make(map[uint64]*topologyClient),
ntfnClientUpdates: make(chan *topologyClientUpdate),
routeCache: make(map[routeTuple][]*Route),
quit: make(chan struct{}),
@ -499,7 +499,7 @@ func (r *ChannelRouter) networkHandler() {
continue
}
r.topologyClients[ntfnUpdate.clientID] = topologyClient{
r.topologyClients[ntfnUpdate.clientID] = &topologyClient{
ntfnChan: ntfnUpdate.ntfnChan,
exit: make(chan struct{}),
}