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

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

Issue 6002053: code review 6002053: net: fix race between Close and Read (Closed)
Left Patch Set: diff -r 762426ee0cca https://code.google.com/p/go Created 11 years, 11 months ago
Right Patch Set: diff -r b25d41fa3e5f https://go.googlecode.com/hg/ Created 11 years, 11 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:
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | src/pkg/net/tcpsock_posix.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
(no file at all)
1 // Copyright 2010 The Go Authors. All rights reserved. 1 // Copyright 2010 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 freebsd linux netbsd openbsd windows 5 // +build darwin freebsd linux netbsd openbsd windows
6 6
7 // (Raw) IP sockets 7 // (Raw) IP sockets
8 8
9 package net 9 package net
10 10
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 return 0, syscall.EINVAL 76 return 0, syscall.EINVAL
77 } 77 }
78 return c.fd.Write(b) 78 return c.fd.Write(b)
79 } 79 }
80 80
81 // Close closes the IP connection. 81 // Close closes the IP connection.
82 func (c *IPConn) Close() error { 82 func (c *IPConn) Close() error {
83 if !c.ok() { 83 if !c.ok() {
84 return syscall.EINVAL 84 return syscall.EINVAL
85 } 85 }
86 » err := c.fd.Close() 86 » return c.fd.Close()
87 » c.fd = nil
88 » return err
89 } 87 }
90 88
91 // LocalAddr returns the local network address. 89 // LocalAddr returns the local network address.
92 func (c *IPConn) LocalAddr() Addr { 90 func (c *IPConn) LocalAddr() Addr {
93 if !c.ok() { 91 if !c.ok() {
94 return nil 92 return nil
95 } 93 }
96 return c.fd.laddr 94 return c.fd.laddr
97 } 95 }
98 96
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 if err != nil { 253 if err != nil {
256 return nil, err 254 return nil, err
257 } 255 }
258 return newIPConn(fd), nil 256 return newIPConn(fd), nil
259 } 257 }
260 258
261 // File returns a copy of the underlying os.File, set to blocking mode. 259 // File returns a copy of the underlying os.File, set to blocking mode.
262 // It is the caller's responsibility to close f when finished. 260 // It is the caller's responsibility to close f when finished.
263 // Closing c does not affect f, and closing f does not affect c. 261 // Closing c does not affect f, and closing f does not affect c.
264 func (c *IPConn) File() (f *os.File, err error) { return c.fd.dup() } 262 func (c *IPConn) File() (f *os.File, err error) { return c.fd.dup() }
LEFTRIGHT

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