From fde3e01f80420c367139a9fe647c618b0223842d Mon Sep 17 00:00:00 2001 From: Maran Date: Mon, 5 May 2014 14:15:31 +0200 Subject: [PATCH] Fixed import cycle --- ethereum.go | 5 +++-- etherpc/server.go | 2 +- ethpub/pub.go | 9 ++++----- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/ethereum.go b/ethereum.go index 6cb1a916f..d6154e213 100644 --- a/ethereum.go +++ b/ethereum.go @@ -4,6 +4,7 @@ import ( "container/list" "github.com/ethereum/eth-go/ethchain" "github.com/ethereum/eth-go/ethdb" + "github.com/ethereum/eth-go/etherpc" "github.com/ethereum/eth-go/ethutil" "github.com/ethereum/eth-go/ethwire" "io/ioutil" @@ -63,7 +64,7 @@ type Ethereum struct { reactor *ethutil.ReactorEngine - // TODO: This no worky: RpcServer *etherpc.JsonRpcServer + RpcServer *etherpc.JsonRpcServer } func New(caps Caps, usePnp bool) (*Ethereum, error) { @@ -338,9 +339,9 @@ func (s *Ethereum) Stop() { close(s.quit) + s.RpcServer.Stop() s.txPool.Stop() s.stateManager.Stop() - // TODO: THIS NO WORKY: s.RpcServer.Stop() close(s.shutdownChan) } diff --git a/etherpc/server.go b/etherpc/server.go index 49b4604cc..0eb229536 100644 --- a/etherpc/server.go +++ b/etherpc/server.go @@ -41,7 +41,7 @@ func (s *JsonRpcServer) Start() { conn, err := s.listener.Accept() if err != nil { ethutil.Config.Log.Infoln("[JSON] Error starting JSON-RPC:", err) - continue + break } ethutil.Config.Log.Debugln("[JSON] Incoming request.") go jsonrpc.ServeConn(conn) diff --git a/ethpub/pub.go b/ethpub/pub.go index 3c579001e..5dc08160f 100644 --- a/ethpub/pub.go +++ b/ethpub/pub.go @@ -1,7 +1,6 @@ package ethpub import ( - "github.com/ethereum/eth-go" "github.com/ethereum/eth-go/ethchain" "github.com/ethereum/eth-go/ethutil" ) @@ -12,11 +11,11 @@ type PEthereum struct { txPool *ethchain.TxPool } -func NewPEthereum(eth *eth.Ethereum) *PEthereum { +func NewPEthereum(sm *ethchain.StateManager, bc *ethchain.BlockChain, txp *ethchain.TxPool) *PEthereum { return &PEthereum{ - eth.StateManager(), - eth.BlockChain(), - eth.TxPool(), + sm, + bc, + txp, } }