aboutsummaryrefslogtreecommitdiffstats
path: root/ethereum.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-05-13 22:38:47 +0800
committerobscuren <geffobscura@gmail.com>2014-05-13 22:38:47 +0800
commitb0798e0a72fef9823053b064f64a1a49681b10ca (patch)
tree0ff11c295033631379d8570b9f2dc2c8db632e2a /ethereum.go
parent9831ba20b234a38f779af9aa49ee88d571d57c6e (diff)
parentc9ac5b0f74e3b1b3026fa1351e682916bf8f7c71 (diff)
downloadgo-tangerine-b0798e0a72fef9823053b064f64a1a49681b10ca.tar.gz
go-tangerine-b0798e0a72fef9823053b064f64a1a49681b10ca.tar.zst
go-tangerine-b0798e0a72fef9823053b064f64a1a49681b10ca.zip
Merge branch 'develop' of github.com-obscure:ethereum/eth-go into develop
Diffstat (limited to 'ethereum.go')
-rw-r--r--ethereum.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/ethereum.go b/ethereum.go
index 92c4e4ba1..94e338c56 100644
--- a/ethereum.go
+++ b/ethereum.go
@@ -65,6 +65,10 @@ type Ethereum struct {
// Specifies the desired amount of maximum peers
MaxPeers int
+ Mining bool
+
+ listening bool
+
reactor *ethutil.ReactorEngine
RpcServer *ethrpc.JsonRpcServer
@@ -128,6 +132,15 @@ func (s *Ethereum) TxPool() *ethchain.TxPool {
func (s *Ethereum) ServerCaps() Caps {
return s.serverCaps
}
+func (s *Ethereum) IsMining() bool {
+ return s.Mining
+}
+func (s *Ethereum) PeerCount() int {
+ return s.peers.Len()
+}
+func (s *Ethereum) IsListening() bool {
+ return s.listening
+}
func (s *Ethereum) AddPeer(conn net.Conn) {
peer := NewPeer(conn, s, true)
@@ -305,7 +318,9 @@ func (s *Ethereum) Start(seed bool) {
ln, err := net.Listen("tcp", ":"+s.Port)
if err != nil {
log.Println("Connection listening disabled. Acting as client")
+ s.listening = false
} else {
+ s.listening = true
// Starting accepting connections
ethutil.Config.Log.Infoln("Ready and accepting connections")
// Start the peer handler