aboutsummaryrefslogtreecommitdiffstats
path: root/whisper/whisperv5
diff options
context:
space:
mode:
authorVlad <gluk256@gmail.com>2018-02-23 21:52:25 +0800
committerVlad <gluk256@gmail.com>2018-02-23 21:52:25 +0800
commit6919c36432226a9d86dbe4a65ed9563dd42a4e08 (patch)
treeebfae50c5cca6b9d734d7a86bfc1c0b83012993e /whisper/whisperv5
parentb677a07d36c957c4221bae952189559ac0c70537 (diff)
downloadgo-tangerine-6919c36432226a9d86dbe4a65ed9563dd42a4e08.tar
go-tangerine-6919c36432226a9d86dbe4a65ed9563dd42a4e08.tar.gz
go-tangerine-6919c36432226a9d86dbe4a65ed9563dd42a4e08.tar.bz2
go-tangerine-6919c36432226a9d86dbe4a65ed9563dd42a4e08.tar.lz
go-tangerine-6919c36432226a9d86dbe4a65ed9563dd42a4e08.tar.xz
go-tangerine-6919c36432226a9d86dbe4a65ed9563dd42a4e08.tar.zst
go-tangerine-6919c36432226a9d86dbe4a65ed9563dd42a4e08.zip
whisper: refactoring
Diffstat (limited to 'whisper/whisperv5')
-rw-r--r--whisper/whisperv5/api.go23
1 files changed, 0 insertions, 23 deletions
diff --git a/whisper/whisperv5/api.go b/whisper/whisperv5/api.go
index b4494d0d6..ee566625c 100644
--- a/whisper/whisperv5/api.go
+++ b/whisper/whisperv5/api.go
@@ -60,32 +60,9 @@ func NewPublicWhisperAPI(w *Whisper) *PublicWhisperAPI {
w: w,
lastUsed: make(map[string]time.Time),
}
-
- go api.run()
return api
}
-// run the api event loop.
-// this loop deletes filter that have not been used within filterTimeout
-func (api *PublicWhisperAPI) run() {
- timeout := time.NewTicker(2 * time.Minute)
- for {
- <-timeout.C
-
- api.mu.Lock()
- for id, lastUsed := range api.lastUsed {
- if time.Since(lastUsed).Seconds() >= filterTimeout {
- delete(api.lastUsed, id)
- if err := api.w.Unsubscribe(id); err != nil {
- log.Error("could not unsubscribe whisper filter", "error", err)
- }
- log.Debug("delete whisper filter (timeout)", "id", id)
- }
- }
- api.mu.Unlock()
- }
-}
-
// Version returns the Whisper sub-protocol version.
func (api *PublicWhisperAPI) Version(ctx context.Context) string {
return ProtocolVersionStr