]> Cypherpunks repositories - gostls13.git/commitdiff
rpc: catch errors from ReadResponseBody.
authorRob Pike <r@golang.org>
Tue, 10 Aug 2010 23:55:02 +0000 (16:55 -0700)
committerRob Pike <r@golang.org>
Tue, 10 Aug 2010 23:55:02 +0000 (16:55 -0700)
Fixes #1014.

R=rsc
CC=golang-dev
https://golang.org/cl/1941041

src/pkg/rpc/client.go

index d742d099fb3deb3414a72649945ece9a8550ccfe..50b883835881ed7528eedc1048259504c5176729 100644 (file)
@@ -94,10 +94,12 @@ func (client *Client) input() {
                client.pending[seq] = c, false
                client.mutex.Unlock()
                err = client.codec.ReadResponseBody(c.Reply)
-               // Empty strings should turn into nil os.Errors
                if response.Error != "" {
                        c.Error = os.ErrorString(response.Error)
+               } else if err != nil {
+                       c.Error = err
                } else {
+                       // Empty strings should turn into nil os.Errors
                        c.Error = nil
                }
                // We don't want to block here.  It is the caller's responsibility to make