mirror of
https://github.com/square/okhttp.git
synced 2026-01-27 04:22:07 +03:00
Synchronize access to idleStartTimeNs.
See https://github.com/square/okhttp/issues/145
This commit is contained in:
@@ -139,17 +139,17 @@ public final class SpdyConnection implements Closeable {
|
||||
return stream;
|
||||
}
|
||||
|
||||
private void setIdle(boolean value) {
|
||||
private synchronized void setIdle(boolean value) {
|
||||
idleStartTimeNs = value ? System.nanoTime() : 0L;
|
||||
}
|
||||
|
||||
/** Returns true if this connection is idle. */
|
||||
public boolean isIdle() {
|
||||
public synchronized boolean isIdle() {
|
||||
return idleStartTimeNs != 0L;
|
||||
}
|
||||
|
||||
/** Returns the time in ns when this connection became idle or 0L if connection is not idle. */
|
||||
public long getIdleStartTimeNs() {
|
||||
public synchronized long getIdleStartTimeNs() {
|
||||
return idleStartTimeNs;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user