1 // Copyright 2015 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
5 // +build dragonfly freebsd linux
11 // Accept4 wraps syscall.Accept4.
12 func (sw
*Switch
) Accept4(s
, flags
int) (ns
int, sa syscall
.Sockaddr
, err error
) {
15 return syscall
.Accept4(s
, flags
)
18 f
:= sw
.fltab
[FilterAccept
]
21 af
, err
:= f
.apply(so
)
25 ns
, sa
, so
.Err
= syscall
.Accept4(s
, flags
)
26 if err
= af
.apply(so
); err
!= nil {
36 sw
.stats
.getLocked(so
.Cookie
).AcceptFailed
++
37 return -1, nil, so
.Err
39 nso
:= sw
.addLocked(ns
, so
.Cookie
.Family(), so
.Cookie
.Type(), so
.Cookie
.Protocol())
40 sw
.stats
.getLocked(nso
.Cookie
).Accepted
++