diff --git a/internal/jsonrpc2/conn.go b/internal/jsonrpc2/conn.go index a47c3d1..2ab8a55 100644 --- a/internal/jsonrpc2/conn.go +++ b/internal/jsonrpc2/conn.go @@ -322,8 +322,8 @@ func (c *Connection) readIncoming(ctx context.Context, reader Reader, toQueue ch // cancelled by id if msg.IsCall() { pending := <-c.incomingBox - c.incomingBox <- pending pending[msg.ID] = entry + c.incomingBox <- pending } // send the message to the incoming queue toQueue <- entry diff --git a/internal/jsonrpc2/jsonrpc2_test.go b/internal/jsonrpc2/jsonrpc2_test.go index 5f0674f..15aca11 100644 --- a/internal/jsonrpc2/jsonrpc2_test.go +++ b/internal/jsonrpc2/jsonrpc2_test.go @@ -60,6 +60,14 @@ var callTests = []invoker{ notify{"unblock", "a"}, collect{"a", true, false}, }}, + sequence{"concurrent", []invoker{ + async{"a", "fork", "a"}, + notify{"unblock", "a"}, + async{"b", "fork", "b"}, + notify{"unblock", "b"}, + collect{"a", true, false}, + collect{"b", true, false}, + }}, } type binder struct {