diff options
author | obscuren <geffobscura@gmail.com> | 2014-05-30 19:04:23 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2014-05-30 19:04:23 +0800 |
commit | 0938b56829b9cbe8804a4ca85b14534908dbdfbc (patch) | |
tree | 3705dc397bdcd4563c2912f2b0cd45dea31d6a65 /ethereal | |
parent | fcbf99a30a15b445c35d70a8a781190a2739845b (diff) | |
download | go-tangerine-0938b56829b9cbe8804a4ca85b14534908dbdfbc.tar go-tangerine-0938b56829b9cbe8804a4ca85b14534908dbdfbc.tar.gz go-tangerine-0938b56829b9cbe8804a4ca85b14534908dbdfbc.tar.bz2 go-tangerine-0938b56829b9cbe8804a4ca85b14534908dbdfbc.tar.lz go-tangerine-0938b56829b9cbe8804a4ca85b14534908dbdfbc.tar.xz go-tangerine-0938b56829b9cbe8804a4ca85b14534908dbdfbc.tar.zst go-tangerine-0938b56829b9cbe8804a4ca85b14534908dbdfbc.zip |
Update peer info
Diffstat (limited to 'ethereal')
-rw-r--r-- | ethereal/ui/gui.go | 16 |
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") |