Debian Codegraph @

export_test.go

raw
1 package mgo
2
3 import (
4 "time"
5 )
6
7 func HackPingDelay(newDelay time.Duration) (restore func()) {
8 globalMutex.Lock()
9 defer globalMutex.Unlock()
10
11 oldDelay := pingDelay
12 restore = func() {
13 globalMutex.Lock()
14 pingDelay = oldDelay
15 globalMutex.Unlock()
16 }
17 pingDelay = newDelay
18 return
19 }
20
21 func HackSyncSocketTimeout(newTimeout time.Duration) (restore func()) {
22 globalMutex.Lock()
23 defer globalMutex.Unlock()
24
25 oldTimeout := syncSocketTimeout
26 restore = func() {
27 globalMutex.Lock()
28 syncSocketTimeout = oldTimeout
29 globalMutex.Unlock()
30 }
31 syncSocketTimeout = newTimeout
32 return
33 }