LFS: Better SSH authentication token timeout handling
* Larger eager timeout to compensate for high-latency lines * Respect eager timeout in case the server uses "expiresIn" Change-Id: Id87da1eea874e70b69eaccf35c84af4c3bb50770 Signed-off-by: Markus Duft <markus.duft@ssi-schaefer.com>
This commit is contained in:
parent
62460b42b7
commit
a9e6da1082
|
@ -273,7 +273,7 @@ public static Protocol.Request toRequest(String operation,
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final class AuthCache {
|
private static final class AuthCache {
|
||||||
private static final long AUTH_CACHE_EAGER_TIMEOUT = 100;
|
private static final long AUTH_CACHE_EAGER_TIMEOUT = 500;
|
||||||
|
|
||||||
private static final SimpleDateFormat ISO_FORMAT = new SimpleDateFormat(
|
private static final SimpleDateFormat ISO_FORMAT = new SimpleDateFormat(
|
||||||
"yyyy-MM-dd'T'HH:mm:ss.SSSX"); //$NON-NLS-1$
|
"yyyy-MM-dd'T'HH:mm:ss.SSSX"); //$NON-NLS-1$
|
||||||
|
@ -290,8 +290,9 @@ public AuthCache(Protocol.ExpiringAction action) {
|
||||||
this.cachedAction = action;
|
this.cachedAction = action;
|
||||||
try {
|
try {
|
||||||
if (action.expiresIn != null && !action.expiresIn.isEmpty()) {
|
if (action.expiresIn != null && !action.expiresIn.isEmpty()) {
|
||||||
this.validUntil = System.currentTimeMillis()
|
this.validUntil = (System.currentTimeMillis()
|
||||||
+ Long.parseLong(action.expiresIn);
|
+ Long.parseLong(action.expiresIn))
|
||||||
|
- AUTH_CACHE_EAGER_TIMEOUT;
|
||||||
} else if (action.expiresAt != null
|
} else if (action.expiresAt != null
|
||||||
&& !action.expiresAt.isEmpty()) {
|
&& !action.expiresAt.isEmpty()) {
|
||||||
this.validUntil = ISO_FORMAT.parse(action.expiresAt)
|
this.validUntil = ISO_FORMAT.parse(action.expiresAt)
|
||||||
|
|
Loading…
Reference in New Issue