server: re-introduce the quit channel to the server
This commit re-introduces the quit channel to the server as an upcoming addition needs to synchronize its shutdown with the lifetime of the server.
This commit is contained in:
parent
947544753f
commit
bee7ed7758
10
server.go
10
server.go
@ -82,8 +82,8 @@ type server struct {
|
|||||||
// advertised to other nodes.
|
// advertised to other nodes.
|
||||||
globalFeatures *lnwire.FeatureVector
|
globalFeatures *lnwire.FeatureVector
|
||||||
|
|
||||||
// localFeatures is an feature vector which represent the features which
|
// localFeatures is an feature vector which represent the features
|
||||||
// only affect the protocol between these two nodes.
|
// which only affect the protocol between these two nodes.
|
||||||
localFeatures *lnwire.FeatureVector
|
localFeatures *lnwire.FeatureVector
|
||||||
|
|
||||||
// currentNodeAnn is the node announcement that has been broadcast to
|
// currentNodeAnn is the node announcement that has been broadcast to
|
||||||
@ -91,6 +91,8 @@ type server struct {
|
|||||||
// changed since last start.
|
// changed since last start.
|
||||||
currentNodeAnn *lnwire.NodeAnnouncement
|
currentNodeAnn *lnwire.NodeAnnouncement
|
||||||
|
|
||||||
|
quit chan struct{}
|
||||||
|
|
||||||
wg sync.WaitGroup
|
wg sync.WaitGroup
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -137,6 +139,8 @@ func newServer(listenAddrs []string, chanDB *channeldb.DB, cc *chainControl,
|
|||||||
|
|
||||||
globalFeatures: globalFeatures,
|
globalFeatures: globalFeatures,
|
||||||
localFeatures: localFeatures,
|
localFeatures: localFeatures,
|
||||||
|
|
||||||
|
quit: make(chan struct{}),
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the debug HTLC flag is on, then we invoice a "master debug"
|
// If the debug HTLC flag is on, then we invoice a "master debug"
|
||||||
@ -364,6 +368,8 @@ func (s *server) Stop() error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
close(s.quit)
|
||||||
|
|
||||||
// Shutdown the wallet, funding manager, and the rpc server.
|
// Shutdown the wallet, funding manager, and the rpc server.
|
||||||
s.cc.chainNotifier.Stop()
|
s.cc.chainNotifier.Stop()
|
||||||
s.chanRouter.Stop()
|
s.chanRouter.Stop()
|
||||||
|
Loading…
Reference in New Issue
Block a user