diff options
author | obscuren <geffobscura@gmail.com> | 2015-02-20 19:59:54 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2015-02-20 19:59:54 +0800 |
commit | 982f73fa6d6f12874729faacd0db14fc78d518dd (patch) | |
tree | 9234eea5a981d73985c6127d5a1ea1cc09cce151 /rpc/util.go | |
parent | 000658539136645e743d83d57a8106b2a9796b93 (diff) | |
download | dexon-982f73fa6d6f12874729faacd0db14fc78d518dd.tar dexon-982f73fa6d6f12874729faacd0db14fc78d518dd.tar.gz dexon-982f73fa6d6f12874729faacd0db14fc78d518dd.tar.bz2 dexon-982f73fa6d6f12874729faacd0db14fc78d518dd.tar.lz dexon-982f73fa6d6f12874729faacd0db14fc78d518dd.tar.xz dexon-982f73fa6d6f12874729faacd0db14fc78d518dd.tar.zst dexon-982f73fa6d6f12874729faacd0db14fc78d518dd.zip |
Added timeout for filter & removed clipboard. Closes #350
Diffstat (limited to 'rpc/util.go')
-rw-r--r-- | rpc/util.go | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/rpc/util.go b/rpc/util.go index 366e315ac..29824bcdb 100644 --- a/rpc/util.go +++ b/rpc/util.go @@ -20,10 +20,12 @@ import ( "encoding/json" "io" "net/http" + "time" "github.com/ethereum/go-ethereum/ethutil" "github.com/ethereum/go-ethereum/logger" "github.com/ethereum/go-ethereum/state" + "github.com/ethereum/go-ethereum/xeth" ) var rpclogger = logger.NewLogger("RPC") @@ -100,3 +102,34 @@ func toLogs(logs state.Logs) (ls []Log) { return } + +type whisperFilter struct { + messages []xeth.WhisperMessage + timeout time.Time +} + +func (w *whisperFilter) add(msgs ...xeth.WhisperMessage) { + w.messages = append(w.messages, msgs...) +} +func (w *whisperFilter) get() []xeth.WhisperMessage { + w.timeout = time.Now() + tmp := w.messages + w.messages = nil + return tmp +} + +type logFilter struct { + logs state.Logs + timeout time.Time +} + +func (l *logFilter) add(logs ...state.Log) { + l.logs = append(l.logs, logs...) +} + +func (l *logFilter) get() state.Logs { + l.timeout = time.Now() + tmp := l.logs + l.logs = nil + return tmp +} |