2015-10-31 01:59:47 +01: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.
|
|
|
|
|
2019-02-01 23:11:50 +01:00
|
|
|
// +build dragonfly freebsd hurd linux netbsd openbsd
|
2015-10-31 01:59:47 +01:00
|
|
|
|
|
|
|
package net
|
|
|
|
|
2017-09-14 19:11:35 +02:00
|
|
|
import "internal/poll"
|
|
|
|
|
2015-10-31 01:59:47 +01:00
|
|
|
func init() {
|
|
|
|
extraTestHookInstallers = append(extraTestHookInstallers, installAccept4TestHook)
|
|
|
|
extraTestHookUninstallers = append(extraTestHookUninstallers, uninstallAccept4TestHook)
|
|
|
|
}
|
|
|
|
|
|
|
|
var (
|
|
|
|
// Placeholders for saving original socket system calls.
|
2017-09-14 19:11:35 +02:00
|
|
|
origAccept4 = poll.Accept4Func
|
2015-10-31 01:59:47 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
func installAccept4TestHook() {
|
2017-09-14 19:11:35 +02:00
|
|
|
poll.Accept4Func = sw.Accept4
|
2015-10-31 01:59:47 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
func uninstallAccept4TestHook() {
|
2017-09-14 19:11:35 +02:00
|
|
|
poll.Accept4Func = origAccept4
|
2015-10-31 01:59:47 +01:00
|
|
|
}
|