summaryrefslogtreecommitdiff
path: root/src/pkg/net/sendfile_linux.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/pkg/net/sendfile_linux.go')
-rw-r--r--src/pkg/net/sendfile_linux.go17
1 files changed, 4 insertions, 13 deletions
diff --git a/src/pkg/net/sendfile_linux.go b/src/pkg/net/sendfile_linux.go
index 6a5a06c8c..e9ab06666 100644
--- a/src/pkg/net/sendfile_linux.go
+++ b/src/pkg/net/sendfile_linux.go
@@ -21,7 +21,7 @@ const maxSendfileSize int = 4 << 20
// non-EOF error.
//
// if handled == false, sendFile performed no work.
-func sendFile(c *netFD, r io.Reader) (written int64, err os.Error, handled bool) {
+func sendFile(c *netFD, r io.Reader) (written int64, err error, handled bool) {
var remain int64 = 1 << 62 // by default, copy until EOF
lr, ok := r.(*io.LimitedReader)
@@ -40,15 +40,6 @@ func sendFile(c *netFD, r io.Reader) (written int64, err os.Error, handled bool)
defer c.wio.Unlock()
c.incref()
defer c.decref()
- if c.wdeadline_delta > 0 {
- // This is a little odd that we're setting the timeout
- // for the entire file but Write has the same issue
- // (if one slurps the whole file into memory and
- // do one large Write). At least they're consistent.
- c.wdeadline = pollserver.Now() + c.wdeadline_delta
- } else {
- c.wdeadline = 0
- }
dst := c.sysfd
src := f.Fd()
@@ -62,18 +53,18 @@ func sendFile(c *netFD, r io.Reader) (written int64, err os.Error, handled bool)
written += int64(n)
remain -= int64(n)
}
- if n == 0 && errno == 0 {
+ if n == 0 && errno == nil {
break
}
if errno == syscall.EAGAIN && c.wdeadline >= 0 {
pollserver.WaitWrite(c)
continue
}
- if errno != 0 {
+ if errno != nil {
// This includes syscall.ENOSYS (no kernel
// support) and syscall.EINVAL (fd types which
// don't implement sendfile together)
- err = &OpError{"sendfile", c.net, c.raddr, os.Errno(errno)}
+ err = &OpError{"sendfile", c.net, c.raddr, errno}
break
}
}