2015-10-31 00:59:47 +00:00
|
|
|
// Copyright 2015 The Go Authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style
|
|
|
|
// license that can be found in the LICENSE file.
|
|
|
|
|
2021-07-30 14:28:58 -07:00
|
|
|
//go:build dragonfly || freebsd || hurd || illumos || linux || netbsd || openbsd
|
2015-10-31 00:59:47 +00:00
|
|
|
|
|
|
|
package net
|
|
|
|
|
2017-09-14 17:11:35 +00:00
|
|
|
import "internal/poll"
|
|
|
|
|
2015-10-31 00:59:47 +00:00
|
|
|
func init() {
|
|
|
|
extraTestHookInstallers = append(extraTestHookInstallers, installAccept4TestHook)
|
|
|
|
extraTestHookUninstallers = append(extraTestHookUninstallers, uninstallAccept4TestHook)
|
|
|
|
}
|
|
|
|
|
|
|
|
var (
|
|
|
|
// Placeholders for saving original socket system calls.
|
2017-09-14 17:11:35 +00:00
|
|
|
origAccept4 = poll.Accept4Func
|
2015-10-31 00:59:47 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func installAccept4TestHook() {
|
2017-09-14 17:11:35 +00:00
|
|
|
poll.Accept4Func = sw.Accept4
|
2015-10-31 00:59:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func uninstallAccept4TestHook() {
|
2017-09-14 17:11:35 +00:00
|
|
|
poll.Accept4Func = origAccept4
|
2015-10-31 00:59:47 +00:00
|
|
|
}
|