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.
8 // Placeholders for saving original socket system calls.
9 origSocket
= socketFunc
10 origClosesocket
= closeFunc
11 origConnect
= connectFunc
12 origConnectEx
= connectExFunc
13 origListen
= listenFunc
14 origAccept
= acceptFunc
17 func installTestHooks() {
18 socketFunc
= sw
.Socket
19 closeFunc
= sw
.Closesocket
20 connectFunc
= sw
.Connect
21 connectExFunc
= sw
.ConnectEx
22 listenFunc
= sw
.Listen
23 acceptFunc
= sw
.AcceptEx
26 func uninstallTestHooks() {
27 socketFunc
= origSocket
28 closeFunc
= origClosesocket
29 connectFunc
= origConnect
30 connectExFunc
= origConnectEx
31 listenFunc
= origListen
32 acceptFunc
= origAccept
35 // forceCloseSockets must be called only from TestMain.
36 func forceCloseSockets() {
37 for s
:= range sw
.Sockets() {