diff --git a/controller/endpoint/http.go b/controller/endpoint/http.go index 07cdc677..5364efad 100644 --- a/controller/endpoint/http.go +++ b/controller/endpoint/http.go @@ -19,41 +19,28 @@ const ( type HTTPEndpointConn struct { mu sync.Mutex ep Endpoint - ex bool - t time.Time client *http.Client } func newHTTPEndpointConn(ep Endpoint) *HTTPEndpointConn { return &HTTPEndpointConn{ ep: ep, - t: time.Now(), } } func (conn *HTTPEndpointConn) Expired() bool { - conn.mu.Lock() - defer conn.mu.Unlock() - if !conn.ex { - if time.Now().Sub(conn.t) > httpExpiresAfter { - conn.ex = true - conn.client = nil - } - } - return conn.ex + return false } func (conn *HTTPEndpointConn) Send(msg string) error { conn.mu.Lock() defer conn.mu.Unlock() - if conn.ex { - return errExpired - } - conn.t = time.Now() + if conn.client == nil { conn.client = &http.Client{ Transport: &http.Transport{ MaxIdleConnsPerHost: httpMaxIdleConnections, + IdleConnTimeout: httpExpiresAfter, }, Timeout: httpRequestTimeout, }