diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2012-02-01 19:26:59 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2012-02-01 19:26:59 +0000 |
commit | 9af4cb9545ce481b8d9d4a13acfe26512032e21b (patch) | |
tree | 7e7e6083ebe59999943a211a17f8ef6f07f17c2f /libgo/go/net/rpc | |
parent | 6b6cd722f329a168f98d1f421834cf40bb33a77d (diff) | |
download | gcc-9af4cb9545ce481b8d9d4a13acfe26512032e21b.zip gcc-9af4cb9545ce481b8d9d4a13acfe26512032e21b.tar.gz gcc-9af4cb9545ce481b8d9d4a13acfe26512032e21b.tar.bz2 |
libgo: Update to weekly.2012-01-27.
From-SVN: r183810
Diffstat (limited to 'libgo/go/net/rpc')
-rw-r--r-- | libgo/go/net/rpc/client.go | 1 | ||||
-rw-r--r-- | libgo/go/net/rpc/server_test.go | 13 |
2 files changed, 10 insertions, 4 deletions
diff --git a/libgo/go/net/rpc/client.go b/libgo/go/net/rpc/client.go index 6fb414e..abc1e59 100644 --- a/libgo/go/net/rpc/client.go +++ b/libgo/go/net/rpc/client.go @@ -145,6 +145,7 @@ func (call *Call) done() { default: // We don't want to block here. It is the caller's responsibility to make // sure the channel has enough buffer space. See comment in Go(). + log.Println("rpc: discarding Call reply due to insufficient Done chan capacity") } } diff --git a/libgo/go/net/rpc/server_test.go b/libgo/go/net/rpc/server_test.go index ae688c0..b05c63c 100644 --- a/libgo/go/net/rpc/server_test.go +++ b/libgo/go/net/rpc/server_test.go @@ -467,13 +467,16 @@ func TestCountMallocsOverHTTP(t *testing.T) { fmt.Printf("mallocs per HTTP rpc round trip: %d\n", countMallocs(dialHTTP, t)) } -type writeCrasher struct{} +type writeCrasher struct { + done chan bool +} func (writeCrasher) Close() error { return nil } -func (writeCrasher) Read(p []byte) (int, error) { +func (w *writeCrasher) Read(p []byte) (int, error) { + <-w.done return 0, io.EOF } @@ -482,7 +485,8 @@ func (writeCrasher) Write(p []byte) (int, error) { } func TestClientWriteError(t *testing.T) { - c := NewClient(writeCrasher{}) + w := &writeCrasher{done: make(chan bool)} + c := NewClient(w) res := false err := c.Call("foo", 1, &res) if err == nil { @@ -491,6 +495,7 @@ func TestClientWriteError(t *testing.T) { if err.Error() != "fake write failure" { t.Error("unexpected value of error:", err) } + w.done <- true } func benchmarkEndToEnd(dial func() (*Client, error), b *testing.B) { @@ -513,7 +518,7 @@ func benchmarkEndToEnd(dial func() (*Client, error), b *testing.B) { go func() { reply := new(Reply) for atomic.AddInt32(&N, -1) >= 0 { - err = client.Call("Arith.Add", args, reply) + err := client.Call("Arith.Add", args, reply) if err != nil { b.Fatalf("rpc error: Add: expected no error but got string %q", err.Error()) } |