Branch: refs/heads/master
Home: https://github.com/conformal/btcd
Commit: a7d5b365b1b169557e0b93783bc8f58638517d79
https://github.com/conformal/btcd/commit/a7d5b365b1b169557e0b93783bc8f58638517d79
Author: Josh Rickmar <[email protected]>
Date: 2014-03-04 (Tue, 04 Mar 2014)
Changed paths:
M blockmanager.go
M mempool.go
M rpcserver.go
M rpcwebsocket.go
Log Message:
-----------
Retain order when processing client notifications.
This change modifies the RPC server's notifiation manager from a
struct with requests, protected by a mutux, to two goroutines. The
first maintains a queue of all notifications and control requests
(registering/unregistering notifications), while the second reads from
the queue and processes notifications and requests one at a time.
Previously, to prevent slowing down block and mempool processing, each
notification would be handled by spawning a new goroutine. This lead
to cases where notifications would end up being sent to clients in a
different order than they were created. Adding a queue keeps the
order of notifications originating from the same goroutine, while also
not slowing down processing while waiting for notifications to be
processed and sent.
ok @davecgh