aboutsummaryrefslogtreecommitdiff
path: root/src/net/splice_linux.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/net/splice_linux.go')
-rw-r--r--src/net/splice_linux.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/net/splice_linux.go b/src/net/splice_linux.go
index 8a4d55af62..69c3f65770 100644
--- a/src/net/splice_linux.go
+++ b/src/net/splice_linux.go
@@ -11,7 +11,7 @@ import (
// splice transfers data from r to c using the splice system call to minimize
// copies from and to userspace. c must be a TCP connection. Currently, splice
-// is only enabled if r is a TCP or Unix connection.
+// is only enabled if r is a TCP or a stream-oriented Unix connection.
//
// If splice returns handled == false, it has performed no work.
func splice(c *netFD, r io.Reader) (written int64, err error, handled bool) {
@@ -28,6 +28,9 @@ func splice(c *netFD, r io.Reader) (written int64, err error, handled bool) {
if tc, ok := r.(*TCPConn); ok {
s = tc.fd
} else if uc, ok := r.(*UnixConn); ok {
+ if uc.fd.net != "unix" {
+ return 0, nil, false
+ }
s = uc.fd
} else {
return 0, nil, false