]> Cypherpunks repositories - gostls13.git/commitdiff
delete a pointless todo in all_test.go.
authorRob Pike <r@golang.org>
Mon, 9 Nov 2009 05:57:59 +0000 (21:57 -0800)
committerRob Pike <r@golang.org>
Mon, 9 Nov 2009 05:57:59 +0000 (21:57 -0800)
address one in rpc/client.go

R=rsc
CC=go-dev
http://go/go-review/1026030

src/pkg/reflect/all_test.go
src/pkg/rpc/client.go

index 45a76259a90c6f2a2346c3111a3868559f683e90..f2e2f92bce2dff5f1000148fc70e8510546c104b 100644 (file)
@@ -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");
 
index 01dcec7db523370555fa65f9282fb6defc9bc074..e1b6a14eca72a32e9350c7aa3889cd5fd18e745b 100644 (file)
@@ -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 {