|
|
|
@ -198,6 +198,8 @@ func (e *Endpoint) SetStateEx(newState EndpointState, takeMutex bool) { |
|
|
|
|
} else { |
|
|
|
|
e.listElement = newList.PushBack(e) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
e.state = newState |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func (e *Endpoint) SetState(newState EndpointState) { |
|
|
|
@ -217,6 +219,7 @@ func (e *Endpoint) Delay(addTime time.Duration) { |
|
|
|
|
|
|
|
|
|
tm := time.Now().Add(addTime) |
|
|
|
|
if e.delayUntil.Before(tm) { |
|
|
|
|
log("ep", 5, "extending delay deadline for endpoint \"%v\" from %v to %v", e, e.delayUntil, tm) |
|
|
|
|
e.delayUntil = tm |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -360,7 +363,9 @@ func (e *Endpoint) NoSuchLogin(login string) { |
|
|
|
|
|
|
|
|
|
// Exhausted gets called when an endpoint no longer has any valid logins and passwords,
|
|
|
|
|
// thus it may be deleted.
|
|
|
|
|
func (e *Endpoint) Exhausted() {
|
|
|
|
|
func (e *Endpoint) Exhausted() { |
|
|
|
|
e.TakeMutex() |
|
|
|
|
defer e.ReleaseMutex() |
|
|
|
|
e.Delete() |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -389,7 +394,11 @@ func GetDelayedEndpoint() (e *Endpoint, waitTime time.Duration) { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return nil, minWaitTime.Sub(currentTime) |
|
|
|
|
if minWaitTime.Before(currentTime) { |
|
|
|
|
return nil, 0 |
|
|
|
|
} else { |
|
|
|
|
return nil, minWaitTime.Sub(currentTime) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func (e *Endpoint) TakeMutex() { |
|
|
|
|