aboutsummaryrefslogtreecommitdiff
path: root/tcpdialer.go
diff options
context:
space:
mode:
authorGravatar xuecai <bluesnow1st@sina.com> 2019-02-04 03:16:39 +0800
committerGravatar Erik Dubbelboer <erik@dubbelboer.com> 2019-02-03 19:16:39 +0000
commit627d63dd25bce25772a610342afd632238463c33 (patch)
tree22cbf9f70eb9310f7d07e7d829789bbe317396be /tcpdialer.go
parentMake InmemoryListener.Dial return when the connection is accepted (diff)
downloadfasthttp-627d63dd25bce25772a610342afd632238463c33.tar.gz
fasthttp-627d63dd25bce25772a610342afd632238463c33.tar.bz2
fasthttp-627d63dd25bce25772a610342afd632238463c33.zip
change timer to public api #525 (#527)
* change acquireTimer and releaseTimer to public api
Diffstat (limited to 'tcpdialer.go')
-rw-r--r--tcpdialer.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/tcpdialer.go b/tcpdialer.go
index e31fd75..906dfdc 100644
--- a/tcpdialer.go
+++ b/tcpdialer.go
@@ -206,14 +206,14 @@ func tryDial(network string, addr *net.TCPAddr, deadline time.Time, concurrencyC
select {
case concurrencyCh <- struct{}{}:
default:
- tc := acquireTimer(timeout)
+ tc := AcquireTimer(timeout)
isTimeout := false
select {
case concurrencyCh <- struct{}{}:
case <-tc.C:
isTimeout = true
}
- releaseTimer(tc)
+ ReleaseTimer(tc)
if isTimeout {
return nil, ErrDialTimeout
}
@@ -242,7 +242,7 @@ func tryDial(network string, addr *net.TCPAddr, deadline time.Time, concurrencyC
err error
)
- tc := acquireTimer(timeout)
+ tc := AcquireTimer(timeout)
select {
case dr := <-ch:
conn = dr.conn
@@ -251,7 +251,7 @@ func tryDial(network string, addr *net.TCPAddr, deadline time.Time, concurrencyC
case <-tc.C:
err = ErrDialTimeout
}
- releaseTimer(tc)
+ ReleaseTimer(tc)
return conn, err
}