internal/jsonrpc2_v2: clarify documentation
For golang/go#46520 Change-Id: Id9cdb539ae6f16e03d02f3b00b0b5ee06042a42f Reviewed-on: https://go-review.googlesource.com/c/tools/+/388594 Trust: Bryan Mills <bcmills@google.com> Run-TryBot: Bryan Mills <bcmills@google.com> Reviewed-by: Ian Cottrell <iancottrell@google.com> gopls-CI: kokoro <noreply+kokoro@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
This commit is contained in:
parent
280ef9a723
commit
87c9a8057e
1 changed files with 55 additions and 30 deletions
|
|
@ -22,7 +22,8 @@ import (
|
|||
// ConnectionOptions itself implements Binder returning itself unmodified, to
|
||||
// allow for the simple cases where no per connection information is needed.
|
||||
type Binder interface {
|
||||
// Bind is invoked when creating a new connection.
|
||||
// Bind returns the ConnectionOptions to use when establishing the passed-in
|
||||
// Connection.
|
||||
// The connection is not ready to use when Bind is called.
|
||||
Bind(context.Context, *Connection) (ConnectionOptions, error)
|
||||
}
|
||||
|
|
@ -234,10 +235,10 @@ func (a *AsyncCall) Await(ctx context.Context, result interface{}) error {
|
|||
return json.Unmarshal(r.result, result)
|
||||
}
|
||||
|
||||
// Respond deliverers a response to an incoming Call.
|
||||
// It is an error to not call this exactly once for any message for which a
|
||||
// handler has previously returned ErrAsyncResponse. It is also an error to
|
||||
// call this for any other message.
|
||||
// Respond delivers a response to an incoming Call.
|
||||
//
|
||||
// Respond must be called exactly once for any message for which a handler
|
||||
// returns ErrAsyncResponse. It must not be called for any other message.
|
||||
func (c *Connection) Respond(id ID, result interface{}, rerr error) error {
|
||||
pending := <-c.incomingBox
|
||||
defer func() { c.incomingBox <- pending }()
|
||||
|
|
|
|||
Loading…
Reference in a new issue