Skip to content

Commit

Permalink
Returning length 0 with EPIPE
Browse files Browse the repository at this point in the history
  • Loading branch information
oxtoacart committed Jun 16, 2018
1 parent 3477e22 commit 56314a2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion lampshade_test.go
Expand Up @@ -115,8 +115,9 @@ func TestStreamCloseRemoteAfterEcho(t *testing.T) {
assert.Equal(t, io.EOF, err)
assert.Equal(t, 0, n)

_, err = conn.Write([]byte("whatever"))
n, err = conn.Write([]byte("whatever"))
assert.Equal(t, syscall.EPIPE, err, "Writing to the connection after the remote end already closed it should fail with an EPIPE")
assert.Equal(t, 0, n)

wg.Wait()
}
Expand Down
2 changes: 1 addition & 1 deletion sendbuffer.go
Expand Up @@ -114,7 +114,7 @@ func (buf *sendBuffer) send(b []byte, writeDeadline time.Time) (int, error) {

func (buf *sendBuffer) doSend(b []byte, writeDeadline time.Time) (int, error) {
if buf.closing {
return len(b), syscall.EPIPE
return 0, syscall.EPIPE
}

if writeDeadline.IsZero() {
Expand Down

0 comments on commit 56314a2

Please sign in to comment.