From 2aeab259c4d24f87d7788fed338b64d99e0865ec Mon Sep 17 00:00:00 2001 From: Jamie Liu Date: Thu, 2 Sep 2021 15:48:04 -0700 Subject: Internal change. PiperOrigin-RevId: 394560866 --- pkg/p9/client.go | 2 +- pkg/p9/transport_flipcall.go | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) (limited to 'pkg/p9') diff --git a/pkg/p9/client.go b/pkg/p9/client.go index 764f1f970..eb496f02f 100644 --- a/pkg/p9/client.go +++ b/pkg/p9/client.go @@ -528,7 +528,7 @@ func (c *Client) sendRecvChannel(t message, r message) error { } // Send the request and receive the server's response. - rsz, err := ch.send(t) + rsz, err := ch.send(t, false /* isServer */) if err != nil { // See above. c.channelsMu.Lock() diff --git a/pkg/p9/transport_flipcall.go b/pkg/p9/transport_flipcall.go index 802254a90..69a9f2537 100644 --- a/pkg/p9/transport_flipcall.go +++ b/pkg/p9/transport_flipcall.go @@ -85,7 +85,7 @@ func (ch *channel) service(cs *connState) error { } r := cs.handle(m) msgRegistry.put(m) - rsz, err = ch.send(r) + rsz, err = ch.send(r, true /* isServer */) if err != nil { return err } @@ -122,7 +122,7 @@ func (ch *channel) Close() error { // // The return value is the size of the received response. Not that in the // server case, this is the size of the next request. -func (ch *channel) send(m message) (uint32, error) { +func (ch *channel) send(m message, isServer bool) (uint32, error) { if log.IsLogging(log.Debug) { log.Debugf("send [channel @%p] %s", ch, m.String()) } @@ -162,7 +162,11 @@ func (ch *channel) send(m message) (uint32, error) { } // Perform the one-shot communication. - return ch.data.SendRecv(ssz) + if isServer { + return ch.data.SendRecv(ssz) + } + // RPCs are expected to return quickly rather than block. + return ch.data.SendRecvFast(ssz) } // recv decodes a message that exists on the channel. -- cgit v1.2.3