Commit 968153d0 authored by Rob Pike's avatar Rob Pike

net/rpc: fix mutex comment

Fixes #8086.

LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/153420044
parent 3cf9accc
...@@ -41,10 +41,10 @@ type Call struct { ...@@ -41,10 +41,10 @@ type Call struct {
type Client struct { type Client struct {
codec ClientCodec codec ClientCodec
sending sync.Mutex reqMutex sync.Mutex // protects following
request Request
mutex sync.Mutex // protects following mutex sync.Mutex // protects following
request Request
seq uint64 seq uint64
pending map[uint64]*Call pending map[uint64]*Call
closing bool // user has called Close closing bool // user has called Close
...@@ -69,8 +69,8 @@ type ClientCodec interface { ...@@ -69,8 +69,8 @@ type ClientCodec interface {
} }
func (client *Client) send(call *Call) { func (client *Client) send(call *Call) {
client.sending.Lock() client.reqMutex.Lock()
defer client.sending.Unlock() defer client.reqMutex.Unlock()
// Register this call. // Register this call.
client.mutex.Lock() client.mutex.Lock()
...@@ -146,7 +146,7 @@ func (client *Client) input() { ...@@ -146,7 +146,7 @@ func (client *Client) input() {
} }
} }
// Terminate pending calls. // Terminate pending calls.
client.sending.Lock() client.reqMutex.Lock()
client.mutex.Lock() client.mutex.Lock()
client.shutdown = true client.shutdown = true
closing := client.closing closing := client.closing
...@@ -162,7 +162,7 @@ func (client *Client) input() { ...@@ -162,7 +162,7 @@ func (client *Client) input() {
call.done() call.done()
} }
client.mutex.Unlock() client.mutex.Unlock()
client.sending.Unlock() client.reqMutex.Unlock()
if debugLog && err != io.EOF && !closing { if debugLog && err != io.EOF && !closing {
log.Println("rpc: client protocol error:", err) log.Println("rpc: client protocol error:", err)
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment