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

Side by Side Diff: src/pkg/net/tcpsock_posix.go

Issue 95320043: code review 95320043: net: fix documentation for SetLinger (Closed)
Patch Set: diff -r 6e10ddc0bbc2 https://code.google.com/p/go Created 9 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:
View unified diff | Download patch
« no previous file with comments | « src/pkg/net/tcpsock_plan9.go ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2009 The Go Authors. All rights reserved. 1 // Copyright 2009 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 // +build darwin dragonfly freebsd linux nacl netbsd openbsd solaris windows 5 // +build darwin dragonfly freebsd linux nacl netbsd openbsd solaris windows
6 6
7 package net 7 package net
8 8
9 import ( 9 import (
10 "io" 10 "io"
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 83
84 // CloseWrite shuts down the writing side of the TCP connection. 84 // CloseWrite shuts down the writing side of the TCP connection.
85 // Most callers should just use Close. 85 // Most callers should just use Close.
86 func (c *TCPConn) CloseWrite() error { 86 func (c *TCPConn) CloseWrite() error {
87 if !c.ok() { 87 if !c.ok() {
88 return syscall.EINVAL 88 return syscall.EINVAL
89 } 89 }
90 return c.fd.closeWrite() 90 return c.fd.closeWrite()
91 } 91 }
92 92
93 // SetLinger sets the behavior of Close() on a connection which still 93 // SetLinger sets the behavior of Close on a connection which still
94 // has data waiting to be sent or to be acknowledged. 94 // has data waiting to be sent or to be acknowledged.
95 // 95 //
96 // If sec < 0 (the default), Close returns immediately and the 96 // If sec < 0 (the default), the operating system finishes sending the
97 // operating system finishes sending the data in the background. 97 // data in the background.
98 // 98 //
99 // If sec == 0, Close returns immediately and the operating system 99 // If sec == 0, the operating system discards any unsent or
100 // discards any unsent or unacknowledged data. 100 // unacknowledged data.
101 // 101 //
102 // If sec > 0, Close blocks for at most sec seconds waiting for data 102 // If sec > 0, the data is sent in the background as with sec < 0. On
103 // to be sent and acknowledged. 103 // some operating systems after sec seconds have elapsed any remaining
104 // unsent data may be discarded.
104 func (c *TCPConn) SetLinger(sec int) error { 105 func (c *TCPConn) SetLinger(sec int) error {
105 if !c.ok() { 106 if !c.ok() {
106 return syscall.EINVAL 107 return syscall.EINVAL
107 } 108 }
108 return setLinger(c.fd, sec) 109 return setLinger(c.fd, sec)
109 } 110 }
110 111
111 // SetKeepAlive sets whether the operating system should send 112 // SetKeepAlive sets whether the operating system should send
112 // keepalive messages on the connection. 113 // keepalive messages on the connection.
113 func (c *TCPConn) SetKeepAlive(keepalive bool) error { 114 func (c *TCPConn) SetKeepAlive(keepalive bool) error {
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 } 290 }
290 if laddr == nil { 291 if laddr == nil {
291 laddr = &TCPAddr{} 292 laddr = &TCPAddr{}
292 } 293 }
293 fd, err := internetSocket(net, laddr, nil, noDeadline, syscall.SOCK_STRE AM, 0, "listen", sockaddrToTCP) 294 fd, err := internetSocket(net, laddr, nil, noDeadline, syscall.SOCK_STRE AM, 0, "listen", sockaddrToTCP)
294 if err != nil { 295 if err != nil {
295 return nil, &OpError{Op: "listen", Net: net, Addr: laddr, Err: e rr} 296 return nil, &OpError{Op: "listen", Net: net, Addr: laddr, Err: e rr}
296 } 297 }
297 return &TCPListener{fd}, nil 298 return &TCPListener{fd}, nil
298 } 299 }
OLDNEW
« no previous file with comments | « src/pkg/net/tcpsock_plan9.go ('k') | no next file » | no next file with comments »

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