Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(59)

Delta Between Two Patch Sets: src/pkg/net/sendfile_windows.go

Issue 4536076: code review 4536076: net: Sendfile for win32. (Closed)
Left Patch Set: diff -r 7358615f596c http://go.googlecode.com/hg/ Created 13 years, 10 months ago
Right Patch Set: diff -r 7358615f596c http://go.googlecode.com/hg/ Created 13 years, 10 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « src/pkg/net/Makefile ('k') | src/pkg/syscall/syscall_windows.go » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 // Copyright 2011 The Go Authors. All rights reserved. 1 // Copyright 2011 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style 2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file. 3 // license that can be found in the LICENSE file.
4 4
5 package net 5 package net
6 6
7 import ( 7 import (
8 "io" 8 "io"
9 "os" 9 "os"
10 "syscall" 10 "syscall"
11 ) 11 )
12
13 // maxSendfileSize is the largest chunk size we ask the kernel to copy
14 // at a time.
15 //const maxSendfileSize uint32 = 0x7fffffff
16 const maxSendfileSize uint32 = 0x000fffff
17 12
18 type sendfileOp struct { 13 type sendfileOp struct {
19 anOp 14 anOp
20 src int32 // source 15 src int32 // source
21 n uint32 16 n uint32
22 } 17 }
23 18
24 func (o *sendfileOp) Submit() (errno int) { 19 func (o *sendfileOp) Submit() (errno int) {
25 return syscall.TransmitFile(int32(o.fd.sysfd), o.src, o.n, 0, &o.o, nil, syscall.TF_WRITE_BEHIND) 20 return syscall.TransmitFile(int32(o.fd.sysfd), o.src, o.n, 0, &o.o, nil, syscall.TF_WRITE_BEHIND)
26 } 21 }
(...skipping 29 matching lines...) Expand all
56 c.wio.Lock() 51 c.wio.Lock()
57 defer c.wio.Unlock() 52 defer c.wio.Unlock()
58 c.incref() 53 c.incref()
59 defer c.decref() 54 defer c.decref()
60 55
61 var o sendfileOp 56 var o sendfileOp
62 o.Init(c) 57 o.Init(c)
63 o.n = uint32(n) 58 o.n = uint32(n)
64 o.src = int32(f.Fd()) 59 o.src = int32(f.Fd())
65 done, err := iosrv.ExecIO(&o, 0) 60 done, err := iosrv.ExecIO(&o, 0)
61 if err != nil {
62 return 0, err, false
63 }
66 if lr != nil { 64 if lr != nil {
67 lr.N -= int64(done) 65 lr.N -= int64(done)
68 } 66 }
69 » return int64(done), err, done > 0 67 » return int64(done), nil, true
70 } 68 }
LEFTRIGHT

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b