1
0
Fork 0
mirror of https://github.com/sourcegraph/jsonrpc2.git synced 2026-06-16 04:04:56 +02:00

make call.done channel buffered so it can discard its value if the call got cancelled

This commit is contained in:
Richard Musiol 2016-11-22 13:03:09 +01:00
parent 7e53931322
commit 9fdd802ab4
No known key found for this signature in database
GPG key ID: D454F1ED1392DE2B

View file

@ -318,7 +318,7 @@ func (c *Conn) send(ctx context.Context, m *anyMessage, wait bool) (*call, error
// responses. // responses.
var cc *call var cc *call
if m.request != nil && wait { if m.request != nil && wait {
cc = &call{request: m.request, seq: c.seq, done: make(chan error)} cc = &call{request: m.request, seq: c.seq, done: make(chan error, 1)}
c.pending[ID{Num: c.seq}] = cc // use next seq as call ID c.pending[ID{Num: c.seq}] = cc // use next seq as call ID
m.request.ID.Num = c.seq m.request.ID.Num = c.seq
c.seq++ c.seq++