mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 02:12:23 +00:00
remove handler inited
This commit is contained in:
parent
0057742b1e
commit
f11bec9e55
2 changed files with 1 additions and 16 deletions
|
|
@ -340,7 +340,7 @@ func New(stack *node.Node, config *ethconfig.Config) (*Ethereum, error) {
|
|||
return err
|
||||
}
|
||||
|
||||
if !eth.handler.inited {
|
||||
if eth.handler.peers.closed {
|
||||
eth.lock.Lock()
|
||||
eth.timeLastBlock = time.Now().Unix()
|
||||
eth.lock.Unlock()
|
||||
|
|
@ -374,11 +374,6 @@ func New(stack *node.Node, config *ethconfig.Config) (*Ethereum, error) {
|
|||
for {
|
||||
time.Sleep(100 * time.Millisecond)
|
||||
eth.lock.Lock()
|
||||
if eth.handler.inited && eth.handler.peers.closed {
|
||||
log.Info("Networking stopped, return without starting peering...")
|
||||
eth.lock.Unlock()
|
||||
return
|
||||
}
|
||||
// ensure 5 seconds has passed between blocks before we start peering so we are sure sync has finished
|
||||
if time.Now().Unix()-eth.timeLastBlock >= 5 {
|
||||
log.Info("Networking and peering start...")
|
||||
|
|
|
|||
|
|
@ -120,8 +120,6 @@ type handler struct {
|
|||
|
||||
// channels for fetcher, syncer, txsyncLoop
|
||||
quitSync chan struct{}
|
||||
// SYSCOIN
|
||||
inited bool
|
||||
wg sync.WaitGroup
|
||||
|
||||
handlerStartCh chan struct{}
|
||||
|
|
@ -196,8 +194,6 @@ func newHandler(config *handlerConfig) (*handler, error) {
|
|||
addTxs := func(txs []*types.Transaction) []error {
|
||||
return h.txpool.Add(txs, false, false)
|
||||
}
|
||||
// SYSCOIN
|
||||
h.inited = false
|
||||
h.txFetcher = fetcher.NewTxFetcher(h.txpool.Has, addTxs, fetchTx, h.removePeer)
|
||||
return h, nil
|
||||
}
|
||||
|
|
@ -433,8 +429,6 @@ func (h *handler) Start(maxPeers int) {
|
|||
h.txsCh = make(chan core.NewTxsEvent, txChanSize)
|
||||
h.txsSub = h.txpool.SubscribeTransactions(h.txsCh, false)
|
||||
go h.txBroadcastLoop()
|
||||
// SYSCOIN
|
||||
h.inited = true
|
||||
// start sync handlers
|
||||
h.txFetcher.Start()
|
||||
|
||||
|
|
@ -444,10 +438,6 @@ func (h *handler) Start(maxPeers int) {
|
|||
}
|
||||
|
||||
func (h *handler) Stop() {
|
||||
// SYSCOIN
|
||||
if !h.inited {
|
||||
return
|
||||
}
|
||||
h.txsSub.Unsubscribe() // quits txBroadcastLoop
|
||||
h.txFetcher.Stop()
|
||||
h.downloader.Terminate()
|
||||
|
|
|
|||
Loading…
Reference in a new issue