LEFT | RIGHT |
(no file at all) | |
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 "errors" | 10 "errors" |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 } | 264 } |
265 if laddr == nil { | 265 if laddr == nil { |
266 return nil, &OpError{"listen", net, nil, errMissingAddress} | 266 return nil, &OpError{"listen", net, nil, errMissingAddress} |
267 } | 267 } |
268 fd, err := unixSocket(net, laddr, nil, "listen", noDeadline) | 268 fd, err := unixSocket(net, laddr, nil, "listen", noDeadline) |
269 if err != nil { | 269 if err != nil { |
270 return nil, err | 270 return nil, err |
271 } | 271 } |
272 err = syscall.Listen(fd.sysfd, listenerBacklog) | 272 err = syscall.Listen(fd.sysfd, listenerBacklog) |
273 if err != nil { | 273 if err != nil { |
274 » » closesocket(fd.sysfd) | 274 » » fd.Close() |
275 return nil, &OpError{Op: "listen", Net: net, Addr: laddr, Err: e
rr} | 275 return nil, &OpError{Op: "listen", Net: net, Addr: laddr, Err: e
rr} |
276 } | 276 } |
277 return &UnixListener{fd, laddr.Name}, nil | 277 return &UnixListener{fd, laddr.Name}, nil |
278 } | 278 } |
279 | 279 |
280 // AcceptUnix accepts the next incoming call and returns the new | 280 // AcceptUnix accepts the next incoming call and returns the new |
281 // connection and the remote address. | 281 // connection and the remote address. |
282 func (l *UnixListener) AcceptUnix() (*UnixConn, error) { | 282 func (l *UnixListener) AcceptUnix() (*UnixConn, error) { |
283 if l == nil || l.fd == nil { | 283 if l == nil || l.fd == nil { |
284 return nil, syscall.EINVAL | 284 return nil, syscall.EINVAL |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
353 } | 353 } |
354 if laddr == nil { | 354 if laddr == nil { |
355 return nil, &OpError{"listen", net, nil, errMissingAddress} | 355 return nil, &OpError{"listen", net, nil, errMissingAddress} |
356 } | 356 } |
357 fd, err := unixSocket(net, laddr, nil, "listen", noDeadline) | 357 fd, err := unixSocket(net, laddr, nil, "listen", noDeadline) |
358 if err != nil { | 358 if err != nil { |
359 return nil, err | 359 return nil, err |
360 } | 360 } |
361 return newUnixConn(fd), nil | 361 return newUnixConn(fd), nil |
362 } | 362 } |
LEFT | RIGHT |