Scoop API

scoop:scoop.http.client:0.1.0

src/authentication/cache.scoop

Selected production source · src/authentication/cache.scoop

1package scoop.http.client
3internal fun clearClientAuthenticationCache(state: ClientState, authenticator: HttpAuthenticator) {
4 if (state.lock.withLock { state.closed }) return
5 clientJob(state.loop, false)
6 clearClientDigestCache(state, authenticator)
7 val flights = state.lock.withLock {
8 val active = ArrayList<ClientBearerFlight>()
9 var index = state.bearerEntries.size
10 while (index > 0L) {
11 index -= 1L
12 val entry = state.bearerEntries[index]
13 if (entry.authenticator !== authenticator) continue
14 entry.discard = true; entry.value = None
15 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)