|
|
@ -17,7 +17,7 @@ import (
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
var (
|
|
|
|
var (
|
|
|
|
globalDialerMap = make(map[net.Destination]*http.Client)
|
|
|
|
globalDialerMap map[net.Destination]*http.Client
|
|
|
|
globalDailerAccess sync.Mutex
|
|
|
|
globalDailerAccess sync.Mutex
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
@ -25,6 +25,10 @@ func getHTTPClient(ctx context.Context, dest net.Destination) (*http.Client, err
|
|
|
|
globalDailerAccess.Lock()
|
|
|
|
globalDailerAccess.Lock()
|
|
|
|
defer globalDailerAccess.Unlock()
|
|
|
|
defer globalDailerAccess.Unlock()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if globalDialerMap == nil {
|
|
|
|
|
|
|
|
globalDialerMap = make(map[net.Destination]*http.Client)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if client, found := globalDialerMap[dest]; found {
|
|
|
|
if client, found := globalDialerMap[dest]; found {
|
|
|
|
return client, nil
|
|
|
|
return client, nil
|
|
|
|
}
|
|
|
|
}
|
|
|
|