Commit d145f0f0 authored by Mikio Hara's avatar Mikio Hara

net: fix documentation for SetLinger

Fixes #7974.

LGTM=iant
R=golang-codereviews, iant
CC=golang-codereviews
https://golang.org/cl/95320043
parent f54f790a
...@@ -44,17 +44,18 @@ func (c *TCPConn) CloseWrite() error { ...@@ -44,17 +44,18 @@ func (c *TCPConn) CloseWrite() error {
return c.fd.closeWrite() return c.fd.closeWrite()
} }
// SetLinger sets the behavior of Close() on a connection which still // SetLinger sets the behavior of Close on a connection which still
// has data waiting to be sent or to be acknowledged. // has data waiting to be sent or to be acknowledged.
// //
// If sec < 0 (the default), Close returns immediately and the // If sec < 0 (the default), the operating system finishes sending the
// operating system finishes sending the data in the background. // data in the background.
// //
// If sec == 0, Close returns immediately and the operating system // If sec == 0, the operating system discards any unsent or
// discards any unsent or unacknowledged data. // unacknowledged data.
// //
// If sec > 0, Close blocks for at most sec seconds waiting for data // If sec > 0, the data is sent in the background as with sec < 0. On
// to be sent and acknowledged. // some operating systems after sec seconds have elapsed any remaining
// unsent data may be discarded.
func (c *TCPConn) SetLinger(sec int) error { func (c *TCPConn) SetLinger(sec int) error {
return syscall.EPLAN9 return syscall.EPLAN9
} }
......
...@@ -90,17 +90,18 @@ func (c *TCPConn) CloseWrite() error { ...@@ -90,17 +90,18 @@ func (c *TCPConn) CloseWrite() error {
return c.fd.closeWrite() return c.fd.closeWrite()
} }
// SetLinger sets the behavior of Close() on a connection which still // SetLinger sets the behavior of Close on a connection which still
// has data waiting to be sent or to be acknowledged. // has data waiting to be sent or to be acknowledged.
// //
// If sec < 0 (the default), Close returns immediately and the // If sec < 0 (the default), the operating system finishes sending the
// operating system finishes sending the data in the background. // data in the background.
// //
// If sec == 0, Close returns immediately and the operating system // If sec == 0, the operating system discards any unsent or
// discards any unsent or unacknowledged data. // unacknowledged data.
// //
// If sec > 0, Close blocks for at most sec seconds waiting for data // If sec > 0, the data is sent in the background as with sec < 0. On
// to be sent and acknowledged. // some operating systems after sec seconds have elapsed any remaining
// unsent data may be discarded.
func (c *TCPConn) SetLinger(sec int) error { func (c *TCPConn) SetLinger(sec int) error {
if !c.ok() { if !c.ok() {
return syscall.EINVAL return syscall.EINVAL
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment