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

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

Issue 8318044: code review 8318044: net: fix possible runtime.PollDesc leak when connect or... (Closed)
Left Patch Set: diff -r 1d49ee511d95 https://code.google.com/p/go Created 10 years, 11 months ago
Right Patch Set: diff -r f2a65f5804ec https://code.google.com/p/go Created 10 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:
Left: Side by side diff | Download
Right: Side by side diff | Download
LEFTRIGHT
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 freebsd linux netbsd openbsd windows 5 // +build darwin freebsd linux netbsd openbsd windows
6 6
7 package net 7 package net
8 8
9 import ( 9 import (
10 "syscall" 10 "syscall"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 closesocket(s) 51 closesocket(s)
52 return nil, err 52 return nil, err
53 } 53 }
54 54
55 // This socket is used by a dialer. 55 // This socket is used by a dialer.
56 if ursa != nil { 56 if ursa != nil {
57 if !deadline.IsZero() { 57 if !deadline.IsZero() {
58 setWriteDeadline(fd, deadline) 58 setWriteDeadline(fd, deadline)
59 } 59 }
60 if err = fd.connect(ursa); err != nil { 60 if err = fd.connect(ursa); err != nil {
61 » » » fd.closeSocket() 61 » » » fd.Close()
dvyukov 2013/04/07 04:27:39 Why do you use closeSocket() here and Close() in l
mikio 2013/04/07 15:10:26 Nope, closeSocket is just a closer for a larval ph
62 return nil, err 62 return nil, err
63 } 63 }
64 fd.isConnected = true 64 fd.isConnected = true
65 if !deadline.IsZero() { 65 if !deadline.IsZero() {
66 setWriteDeadline(fd, time.Time{}) 66 setWriteDeadline(fd, time.Time{})
67 } 67 }
68 } 68 }
69 69
70 lsa, _ := syscall.Getsockname(s) 70 lsa, _ := syscall.Getsockname(s)
71 laddr := toAddr(lsa) 71 laddr := toAddr(lsa)
72 rsa, _ := syscall.Getpeername(s) 72 rsa, _ := syscall.Getpeername(s)
73 if rsa == nil { 73 if rsa == nil {
74 rsa = ursa 74 rsa = ursa
75 } 75 }
76 raddr := toAddr(rsa) 76 raddr := toAddr(rsa)
77 fd.setAddr(laddr, raddr) 77 fd.setAddr(laddr, raddr)
78 return fd, nil 78 return fd, nil
79 } 79 }
LEFTRIGHT

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