go-ethereum/rpc
Felix Lange f5f042ffdc rpc: ensure client doesn't block for slow subscribers
I initially made the client block if the 100-element buffer was
exceeded. It turns out that this is inconvenient for simple uses of the
client which subscribe and perform calls on the same goroutine, e.g.

    client, _ := rpc.Dial(...)
    ch := make(chan int) // note: no buffer
    sub, _ := client.EthSubscribe(ch, "something")
    for event := range ch {
        client.Call(...)
    }

This innocent looking code will lock up if the server suddenly decides
to send 2000 notifications. In this case, the client's main loop won't
accept the call because it is trying to deliver a notification to ch.

The issue is kind of hard to explain in the docs and few people will
actually read them. Buffering is the simple option and works with close
to no overhead for subscribers that always listen.
2016-08-05 20:48:33 +02:00
..
client.go rpc: ensure client doesn't block for slow subscribers 2016-08-05 20:48:33 +02:00
client_context_go1.4.go rpc: add new client, use it everywhere 2016-07-22 23:21:27 +02:00
client_context_go1.5.go rpc: add new client, use it everywhere 2016-07-22 23:21:27 +02:00
client_context_go1.6.go rpc: add new client, use it everywhere 2016-07-22 23:21:27 +02:00
client_context_go1.7.go rpc: add new client, use it everywhere 2016-07-22 23:21:27 +02:00
client_example_test.go rpc: add new client, use it everywhere 2016-07-22 23:21:27 +02:00
client_test.go rpc: ensure client doesn't block for slow subscribers 2016-08-05 20:48:33 +02:00
doc.go README, core, rpc: fix various typos 2016-06-21 17:38:35 +01:00
errors.go rpc: add new client, use it everywhere 2016-07-22 23:21:27 +02:00
http.go rpc: add new client, use it everywhere 2016-07-22 23:21:27 +02:00
inproc.go rpc: add new client, use it everywhere 2016-07-22 23:21:27 +02:00
ipc.go rpc: add new client, use it everywhere 2016-07-22 23:21:27 +02:00
ipc_unix.go rpc: add new client, use it everywhere 2016-07-22 23:21:27 +02:00
ipc_windows.go rpc: add new client, use it everywhere 2016-07-22 23:21:27 +02:00
json.go rpc: add new client, use it everywhere 2016-07-22 23:21:27 +02:00
json_test.go all: fix go vet warnings 2016-04-15 11:17:27 +02:00
notification.go rpc: add new client, use it everywhere 2016-07-22 23:21:27 +02:00
notification_test.go rpc: ensure client doesn't block for slow subscribers 2016-08-05 20:48:33 +02:00
server.go rpc: add new client, use it everywhere 2016-07-22 23:21:27 +02:00
server_test.go rpc: add new client, use it everywhere 2016-07-22 23:21:27 +02:00
types.go rpc: add new client, use it everywhere 2016-07-22 23:21:27 +02:00
types_test.go rpc: migrated the RPC insterface to a new reflection based RPC layer 2016-01-26 13:51:50 +01:00
utils.go rpc: add new client, use it everywhere 2016-07-22 23:21:27 +02:00
websocket.go rpc: add new client, use it everywhere 2016-07-22 23:21:27 +02:00