scoop:scoop.http.client:0.1.0
src/authentication/cache.scoop
Selected production source · src/authentication/cache.scoop
1
package scoop.http.client3
internal fun clearClientAuthenticationCache(state: ClientState, authenticator: HttpAuthenticator) {4
if (state.lock.withLock { state.closed }) return5
clientJob(state.loop, false)6
clearClientDigestCache(state, authenticator)7
val flights = state.lock.withLock {8
val active = ArrayList<ClientBearerFlight>()9
var index = state.bearerEntries.size10
while (index > 0L) {11
index -= 1L12
val entry = state.bearerEntries[index]13
if (entry.authenticator !== authenticator) continue14
entry.discard = true; entry.value = None15
when (entry.flight) {16
case Some(val flight) -> active.add(flight)17
case None -> state.bearerEntries.removeAt(index)18
}19
}20
active.toArray()21
}22
for (flight in flights) stopClientBearerFlight(flight)23
}