aboutsummaryrefslogtreecommitdiffstats
path: root/ethereal
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-05-30 19:04:23 +0800
committerobscuren <geffobscura@gmail.com>2014-05-30 19:04:23 +0800
commit0938b56829b9cbe8804a4ca85b14534908dbdfbc (patch)
tree3705dc397bdcd4563c2912f2b0cd45dea31d6a65 /ethereal
parentfcbf99a30a15b445c35d70a8a781190a2739845b (diff)
downloaddexon-0938b56829b9cbe8804a4ca85b14534908dbdfbc.tar.gz
dexon-0938b56829b9cbe8804a4ca85b14534908dbdfbc.tar.zst
dexon-0938b56829b9cbe8804a4ca85b14534908dbdfbc.zip
Update peer info
Diffstat (limited to 'ethereal')
-rw-r--r--ethereal/ui/gui.go16
1 files changed, 13 insertions, 3 deletions
diff --git a/ethereal/ui/gui.go b/ethereal/ui/gui.go
index d08c1b118..7c37e2d62 100644
--- a/ethereal/ui/gui.go
+++ b/ethereal/ui/gui.go
@@ -109,9 +109,11 @@ func (gui *Gui) showWallet(context *qml.Context) (*qml.Window, error) {
win := gui.createWindow(component)
- go gui.setInitialBlockChain()
- go gui.loadAddressBook()
- go gui.readPreviousTransactions()
+ gui.setInitialBlockChain()
+ gui.loadAddressBook()
+ gui.readPreviousTransactions()
+ gui.setPeerInfo()
+
go gui.update()
return win, nil
@@ -206,11 +208,13 @@ func (gui *Gui) update() {
blockChan := make(chan ethutil.React, 1)
txChan := make(chan ethutil.React, 1)
objectChan := make(chan ethutil.React, 1)
+ peerChan := make(chan ethutil.React, 1)
reactor.Subscribe("newBlock", blockChan)
reactor.Subscribe("newTx:pre", txChan)
reactor.Subscribe("newTx:post", txChan)
reactor.Subscribe("object:"+string(namereg), objectChan)
+ reactor.Subscribe("peerList", peerChan)
state := gui.eth.StateManager().TransState()
@@ -259,10 +263,16 @@ func (gui *Gui) update() {
}
case <-objectChan:
gui.loadAddressBook()
+ case <-peerChan:
+ gui.setPeerInfo()
}
}
}
+func (gui *Gui) setPeerInfo() {
+ gui.win.Root().Call("setPeers", fmt.Sprintf("%d / %d", gui.eth.PeerCount(), gui.eth.MaxPeers))
+}
+
// Logging functions that log directly to the GUI interface
func (gui *Gui) Println(v ...interface{}) {
str := strings.TrimRight(fmt.Sprintln(v...), "\n")