diff options
author | Zsolt Felfoldi <zsfelfoldi@gmail.com> | 2017-01-23 09:35:46 +0800 |
---|---|---|
committer | Zsolt Felfoldi <zsfelfoldi@gmail.com> | 2017-01-26 11:23:53 +0800 |
commit | 12379c697aa72f4ce08733638e6f7e5dcdf3f94f (patch) | |
tree | c3f44e91386e0eb8fcd64a7ebdf5cf9ef20991df /les | |
parent | f5348e17f8d487a7bd34ccef6dcb6dc376407f40 (diff) | |
download | go-tangerine-12379c697aa72f4ce08733638e6f7e5dcdf3f94f.tar go-tangerine-12379c697aa72f4ce08733638e6f7e5dcdf3f94f.tar.gz go-tangerine-12379c697aa72f4ce08733638e6f7e5dcdf3f94f.tar.bz2 go-tangerine-12379c697aa72f4ce08733638e6f7e5dcdf3f94f.tar.lz go-tangerine-12379c697aa72f4ce08733638e6f7e5dcdf3f94f.tar.xz go-tangerine-12379c697aa72f4ce08733638e6f7e5dcdf3f94f.tar.zst go-tangerine-12379c697aa72f4ce08733638e6f7e5dcdf3f94f.zip |
les: remove delayed les server starting
Diffstat (limited to 'les')
-rw-r--r-- | les/server.go | 30 |
1 files changed, 3 insertions, 27 deletions
diff --git a/les/server.go b/les/server.go index e55616a44..c4c6fcab5 100644 --- a/les/server.go +++ b/les/server.go @@ -42,9 +42,7 @@ type LesServer struct { fcManager *flowcontrol.ClientManager // nil if our node is client only fcCostStats *requestCostStats defParams *flowcontrol.ServerParams - srvr *p2p.Server - synced, stopped bool - lock sync.Mutex + stopped bool } func NewLesServer(eth *eth.Ethereum, config *eth.Config) (*LesServer, error) { @@ -70,35 +68,13 @@ func (s *LesServer) Protocols() []p2p.Protocol { return s.protocolManager.SubProtocols } -// Start only starts the actual service if the ETH protocol has already been synced, -// otherwise it will be started by Synced() +// Start starts the LES server func (s *LesServer) Start(srvr *p2p.Server) { - s.lock.Lock() - defer s.lock.Unlock() - - s.srvr = srvr - if s.synced { - s.protocolManager.Start(s.srvr) - } -} - -// Synced notifies the server that the ETH protocol has been synced and LES service can be started -func (s *LesServer) Synced() { - s.lock.Lock() - defer s.lock.Unlock() - - s.synced = true - if s.srvr != nil && !s.stopped { - s.protocolManager.Start(s.srvr) - } + s.protocolManager.Start(srvr) } // Stop stops the LES service func (s *LesServer) Stop() { - s.lock.Lock() - defer s.lock.Unlock() - - s.stopped = true s.fcCostStats.store() s.fcManager.Stop() go func() { |