rpc: add context argument to EthSubscribe

It's inconsistent not to pass it and most callers will
work with contexts anyway.
This commit is contained in:
Felix Lange
2016-08-05 13:24:48 +02:00
parent f5f042ffdc
commit e32925397b
3 changed files with 39 additions and 34 deletions

View File

@ -215,7 +215,7 @@ func TestClientSubscribeInvalidArg(t *testing.T) {
t.Error(string(buf))
}
}()
client.EthSubscribe(arg, "foo_bar")
client.EthSubscribe(context.Background(), arg, "foo_bar")
}
check(true, nil)
check(true, 1)
@ -233,7 +233,7 @@ func TestClientSubscribe(t *testing.T) {
nc := make(chan int)
count := 10
sub, err := client.EthSubscribe(nc, "someSubscription", count, 0)
sub, err := client.EthSubscribe(context.Background(), nc, "someSubscription", count, 0)
if err != nil {
t.Fatal("can't subscribe:", err)
}
@ -275,7 +275,7 @@ func TestClientSubscribeClose(t *testing.T) {
err error
)
go func() {
sub, err = client.EthSubscribe(nc, "hangSubscription", 999)
sub, err = client.EthSubscribe(context.Background(), nc, "hangSubscription", 999)
errc <- err
}()
@ -311,7 +311,7 @@ func TestClientNotificationStorm(t *testing.T) {
// Subscribe on the server. It will start sending many notifications
// very quickly.
nc := make(chan int)
sub, err := client.EthSubscribe(nc, "someSubscription", count, 0)
sub, err := client.EthSubscribe(ctx, nc, "someSubscription", count, 0)
if err != nil {
t.Fatal("can't subscribe:", err)
}