diff options
author | zelig <viktor.tron@gmail.com> | 2014-07-05 02:38:44 +0800 |
---|---|---|
committer | zelig <viktor.tron@gmail.com> | 2014-07-05 02:38:44 +0800 |
commit | 584d1c61ec93df3417f2ce8ece041b81a5ec63a6 (patch) | |
tree | 2e1ea3d9ef4f81b3d29174022f334f35d06e4623 /ethereum.go | |
parent | af2726414078840aae32aa4c982d3a8c5cf66ef5 (diff) | |
download | dexon-584d1c61ec93df3417f2ce8ece041b81a5ec63a6.tar.gz dexon-584d1c61ec93df3417f2ce8ece041b81a5ec63a6.tar.zst dexon-584d1c61ec93df3417f2ce8ece041b81a5ec63a6.zip |
use ethreact.Event and ethreact.ReactorEngine
Diffstat (limited to 'ethereum.go')
-rw-r--r-- | ethereum.go | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/ethereum.go b/ethereum.go index 35d98e831..de4e915a1 100644 --- a/ethereum.go +++ b/ethereum.go @@ -6,6 +6,7 @@ import ( "github.com/ethereum/eth-go/ethchain" "github.com/ethereum/eth-go/ethcrypto" "github.com/ethereum/eth-go/ethlog" + "github.com/ethereum/eth-go/ethreact" "github.com/ethereum/eth-go/ethrpc" "github.com/ethereum/eth-go/ethutil" "github.com/ethereum/eth-go/ethwire" @@ -71,7 +72,7 @@ type Ethereum struct { listening bool - reactor *ethutil.ReactorEngine + reactor *ethreact.ReactorEngine RpcServer *ethrpc.JsonRpcServer @@ -106,7 +107,7 @@ func New(db ethutil.Database, clientIdentity ethwire.ClientIdentity, keyManager keyManager: keyManager, clientIdentity: clientIdentity, } - ethereum.reactor = ethutil.NewReactorEngine() + ethereum.reactor = ethreact.New() ethereum.txPool = ethchain.NewTxPool(ethereum) ethereum.blockChain = ethchain.NewBlockChain(ethereum) @@ -118,7 +119,7 @@ func New(db ethutil.Database, clientIdentity ethwire.ClientIdentity, keyManager return ethereum, nil } -func (s *Ethereum) Reactor() *ethutil.ReactorEngine { +func (s *Ethereum) Reactor() *ethreact.ReactorEngine { return s.reactor } @@ -350,6 +351,7 @@ func (s *Ethereum) ReapDeadPeerHandler() { // Start the ethereum func (s *Ethereum) Start(seed bool) { + s.reactor.Start() // Bind to addr and port ln, err := net.Listen("tcp", ":"+s.Port) if err != nil { @@ -461,6 +463,9 @@ func (s *Ethereum) Stop() { s.txPool.Stop() s.stateManager.Stop() + s.reactor.Flush() + s.reactor.Stop() + ethlogger.Infoln("Server stopped") close(s.shutdownChan) } |