This reportedly happens on CentOS 5.11. The real code will work fine;
this test is assuming that the unexported slice function will handle
the splice, but if pipe2 does not work then it doesn't. The relevant
code in internal/poll/splice_linux.go says "Falling back to pipe is
possible, but prior to 2.6.29 splice returns -EAGAIN instead of 0 when
the connection is closed."
Reviewed-on: https://go-review.googlesource.com/138838
From-SVN: r264793
-53d0d7ca278a5612fcdb5fb098e7bf950a0178ef
+098e36f4ddfcf50aeb34509b5f25b86d7050749c
The first line of this file holds the git revision number of the last
merge done from the gofrontend repository.
"fmt"
"io"
"io/ioutil"
+ "os"
"sync"
+ "syscall"
"testing"
)
serverUp.Close()
_, err, handled := splice(serverDown.(*TCPConn).fd, serverUp)
if !handled {
+ if serr, ok := err.(*os.SyscallError); ok && serr.Syscall == "pipe2" && serr.Err == syscall.ENOSYS {
+ t.Skip("pipe2 not supported")
+ }
+
t.Errorf("closed connection: got err = %v, handled = %t, want handled = true", err, handled)
}
lr := &io.LimitedReader{