Commit e02f2b51 authored by Rob Pike's avatar Rob Pike

delete a pointless todo in all_test.go.

address one in rpc/client.go

R=rsc
CC=go-dev
http://go/go-review/1026030
parent c532940e
......@@ -349,7 +349,7 @@ func TestPtrPointTo(t *testing.T) {
}
}
func TestAll(t *testing.T) { // TODO(r): wrap up better
func TestAll(t *testing.T) {
testType(t, 1, Typeof((int8)(0)), "int8");
testType(t, 2, Typeof((*int8)(nil)).(*PtrType).Elem(), "int8");
......
......@@ -96,7 +96,7 @@ func (client *Client) input() {
_ = call.Done <- call; // do not block
}
client.mutex.Unlock();
log.Stderr("client protocol error:", err);
log.Stderr("rpc: client protocol error:", err);
}
// NewClient returns a new Client to handle requests to the
......@@ -144,18 +144,22 @@ func Dial(network, address string) (*Client, os.Error) {
// Go invokes the function asynchronously. It returns the Call structure representing
// the invocation. The done channel will signal when the call is complete by returning
// the same Call object. If done is nil, Go will allocate a new channel.
// If non-nil, done must be buffered or Go will deliberately crash.
func (client *Client) Go(serviceMethod string, args interface{}, reply interface{}, done chan *Call) *Call {
c := new(Call);
c.ServiceMethod = serviceMethod;
c.Args = args;
c.Reply = reply;
if done == nil {
done = make(chan *Call, 1); // buffered.
done = make(chan *Call, 10); // buffered.
} else {
// TODO(r): check cap > 0
// If caller passes done != nil, it must arrange that
// done has enough buffer for the number of simultaneous
// RPCs that will be using that channel.
// RPCs that will be using that channel. If the channel
// is totally unbuffered, it's best not to run at all.
if cap(done) == 0 {
log.Crash("rpc: done channel is unbuffered");
}
}
c.Done = done;
if client.shutdown != nil {
......
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