aboutsummaryrefslogtreecommitdiffstats
path: root/event
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-02-20 22:18:07 +0800
committerobscuren <geffobscura@gmail.com>2015-02-20 22:18:07 +0800
commit75625801f597061076d1e5863f97c9ea12aa10e4 (patch)
treef45334ddc09a191c8dfe4e75f98f736bf67979f6 /event
parentea9a549bbdc8377bca73f1417f2dc4a18396a382 (diff)
parenta59cd94625f589bb167be7a9c4588ff959dcfc00 (diff)
downloaddexon-75625801f597061076d1e5863f97c9ea12aa10e4.tar.gz
dexon-75625801f597061076d1e5863f97c9ea12aa10e4.tar.zst
dexon-75625801f597061076d1e5863f97c9ea12aa10e4.zip
fixed merge
Diffstat (limited to 'event')
-rw-r--r--event/filter/eth_filter.go10
1 files changed, 7 insertions, 3 deletions
diff --git a/event/filter/eth_filter.go b/event/filter/eth_filter.go
index d298d914d..73d2cd935 100644
--- a/event/filter/eth_filter.go
+++ b/event/filter/eth_filter.go
@@ -3,6 +3,7 @@ package filter
// TODO make use of the generic filtering system
import (
+ "fmt"
"sync"
"github.com/ethereum/go-ethereum/core"
@@ -37,17 +38,18 @@ func (self *FilterManager) Stop() {
func (self *FilterManager) InstallFilter(filter *core.Filter) (id int) {
self.filterMu.Lock()
+ defer self.filterMu.Unlock()
id = self.filterId
self.filters[id] = filter
self.filterId++
- self.filterMu.Unlock()
+
return id
}
func (self *FilterManager) UninstallFilter(id int) {
self.filterMu.Lock()
+ defer self.filterMu.Unlock()
delete(self.filters, id)
- self.filterMu.Unlock()
}
// GetFilter retrieves a filter installed using InstallFilter.
@@ -62,7 +64,7 @@ func (self *FilterManager) filterLoop() {
// Subscribe to events
events := self.eventMux.Subscribe(
core.PendingBlockEvent{},
- core.ChainEvent{},
+ //core.ChainEvent{},
state.Logs(nil))
out:
@@ -73,6 +75,7 @@ out:
case event := <-events.Chan():
switch event := event.(type) {
case core.ChainEvent:
+ fmt.Println("filter start")
self.filterMu.RLock()
for _, filter := range self.filters {
if filter.BlockCallback != nil {
@@ -80,6 +83,7 @@ out:
}
}
self.filterMu.RUnlock()
+ fmt.Println("filter stop")
case core.PendingBlockEvent:
self.filterMu.RLock()