Allow clients to Close a Session, general tidy up
- Allow clients to call Close on a Session to clean up resources - Switch to the %w verb for error wrapping - Fix typo on Port struct after verifying the server does not have a typo
This commit is contained in:
parent
22433a57db
commit
57d04dc5f0
5 changed files with 29 additions and 18 deletions
3
rpc.go
3
rpc.go
|
|
@ -20,7 +20,6 @@ func newRPCClient(conn io.ReadWriteCloser) *rpcClient {
|
|||
|
||||
func (r *rpcClient) connect(ctx context.Context) {
|
||||
stream := jsonrpc2.NewBufferedStream(r.conn, jsonrpc2.VSCodeObjectCodec{})
|
||||
// TODO(adonovan): fix: ensure r.Conn is eventually Closed!
|
||||
r.Conn = jsonrpc2.NewConn(ctx, stream, nullHandler{})
|
||||
}
|
||||
|
||||
|
|
@ -30,7 +29,7 @@ func (r *rpcClient) do(ctx context.Context, method string, args, result interfac
|
|||
|
||||
waiter, err := r.Conn.DispatchCall(ctx, method, args)
|
||||
if err != nil {
|
||||
return fmt.Errorf("error dispatching %q call: %v", method, err)
|
||||
return fmt.Errorf("error dispatching %q call: %w", method, err)
|
||||
}
|
||||
|
||||
return waiter.Wait(ctx, result)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue