From 6ee89e76da67897807e9ac8a6461b28dabdc8417 Mon Sep 17 00:00:00 2001 From: Sonic Date: Mon, 6 May 2019 15:09:04 +0800 Subject: lds: rename LesServer to LdsServer --- lds/handler.go | 2 +- lds/helper_test.go | 2 +- lds/peer.go | 2 +- lds/server.go | 14 +++++++------- 4 files changed, 10 insertions(+), 10 deletions(-) (limited to 'lds') diff --git a/lds/handler.go b/lds/handler.go index 8bc374a24..2eece6f25 100644 --- a/lds/handler.go +++ b/lds/handler.go @@ -98,7 +98,7 @@ type ProtocolManager struct { blockchain BlockChain chainDb ethdb.Database odr *LdsOdr - server *LesServer + server *LdsServer serverPool *serverPool clientPool *freeClientPool lesTopic discv5.Topic diff --git a/lds/helper_test.go b/lds/helper_test.go index 5744b6dd6..a88a0cabc 100644 --- a/lds/helper_test.go +++ b/lds/helper_test.go @@ -181,7 +181,7 @@ func newTestProtocolManager(lightSync bool, blocks int, generator func(int, *cor return nil, err } if !lightSync { - srv := &LesServer{ldsCommons: ldsCommons{protocolManager: pm}} + srv := &LdsServer{ldsCommons: ldsCommons{protocolManager: pm}} pm.server = srv srv.defParams = &flowcontrol.ServerParams{ diff --git a/lds/peer.go b/lds/peer.go index f8d89089c..5427855f6 100644 --- a/lds/peer.go +++ b/lds/peer.go @@ -389,7 +389,7 @@ func (p *peer) sendReceiveHandshake(sendList keyValueList) (keyValueList, error) // Handshake executes the les protocol handshake, negotiating version number, // network IDs, difficulties, head and genesis blocks. -func (p *peer) Handshake(td *big.Int, head common.Hash, headNum uint64, genesis common.Hash, server *LesServer) error { +func (p *peer) Handshake(td *big.Int, head common.Hash, headNum uint64, genesis common.Hash, server *LdsServer) error { p.lock.Lock() defer p.lock.Unlock() diff --git a/lds/server.go b/lds/server.go index 1878917c0..4784da4d9 100644 --- a/lds/server.go +++ b/lds/server.go @@ -38,7 +38,7 @@ import ( "github.com/dexon-foundation/dexon/rlp" ) -type LesServer struct { +type LdsServer struct { ldsCommons fcManager *flowcontrol.ClientManager // nil if our node is client only @@ -49,7 +49,7 @@ type LesServer struct { quitSync chan struct{} } -func NewLesServer(eth *eth.Ethereum, config *eth.Config) (*LesServer, error) { +func NewLdsServer(eth *eth.Ethereum, config *eth.Config) (*LdsServer, error) { quitSync := make(chan struct{}) pm, err := NewProtocolManager(eth.BlockChain().Config(), light.DefaultServerIndexerConfig, false, config.NetworkId, eth.EventMux(), eth.Engine(), newPeerSet(), eth.BlockChain(), eth.TxPool(), eth.ChainDb(), nil, nil, nil, quitSync, new(sync.WaitGroup)) if err != nil { @@ -61,7 +61,7 @@ func NewLesServer(eth *eth.Ethereum, config *eth.Config) (*LesServer, error) { lesTopics[i] = lesTopic(eth.BlockChain().Genesis().Hash(), pv) } - srv := &LesServer{ + srv := &LdsServer{ ldsCommons: ldsCommons{ config: config, chainDb: eth.ChainDb(), @@ -107,12 +107,12 @@ func NewLesServer(eth *eth.Ethereum, config *eth.Config) (*LesServer, error) { return srv, nil } -func (s *LesServer) Protocols() []p2p.Protocol { +func (s *LdsServer) Protocols() []p2p.Protocol { return s.makeProtocols(ServerProtocolVersions) } // Start starts the LES server -func (s *LesServer) Start(srvr *p2p.Server) { +func (s *LdsServer) Start(srvr *p2p.Server) { s.protocolManager.Start(s.config.LightPeers) if srvr.DiscV5 != nil { for _, topic := range s.lesTopics { @@ -130,12 +130,12 @@ func (s *LesServer) Start(srvr *p2p.Server) { s.protocolManager.blockLoop() } -func (s *LesServer) SetBloomBitsIndexer(bloomIndexer *core.ChainIndexer) { +func (s *LdsServer) SetBloomBitsIndexer(bloomIndexer *core.ChainIndexer) { bloomIndexer.AddChildIndexer(s.bloomTrieIndexer) } // Stop stops the LES service -func (s *LesServer) Stop() { +func (s *LdsServer) Stop() { s.chtIndexer.Close() // bloom trie indexer is closed by parent bloombits indexer s.fcCostStats.store() -- cgit v1.2.3