Skip to content

Commit

Permalink
Merge pull request square#2594 from nfuller/RemoveUnusedMethods
Browse files Browse the repository at this point in the history
Remove methods from FramedConnection that are unused
  • Loading branch information
swankjesse committed May 31, 2016
2 parents c8c073c + a18d4e1 commit 63ae84d
Showing 1 changed file with 0 additions and 23 deletions.
23 changes: 0 additions & 23 deletions okhttp/src/main/java/okhttp3/internal/framed/FramedConnection.java
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ public final class FramedConnection implements Closeable {
private int lastGoodStreamId;
private int nextStreamId;
private boolean shutdown;
private long idleStartTimeNs = System.nanoTime();

/** Ensures push promise callbacks events are sent in order per stream. */
private final ExecutorService pushExecutor;
Expand Down Expand Up @@ -190,34 +189,14 @@ synchronized FramedStream getStream(int id) {

synchronized FramedStream removeStream(int streamId) {
FramedStream stream = streams.remove(streamId);
if (stream != null && streams.isEmpty()) {
setIdle(true);
}
notifyAll(); // The removed stream may be blocked on a connection-wide window update.
return stream;
}

private synchronized void setIdle(boolean value) {
idleStartTimeNs = value ? System.nanoTime() : Long.MAX_VALUE;
}

/** Returns true if this connection is idle. */
public synchronized boolean isIdle() {
return idleStartTimeNs != Long.MAX_VALUE;
}

public synchronized int maxConcurrentStreams() {
return peerSettings.getMaxConcurrentStreams(Integer.MAX_VALUE);
}

/**
* Returns the time in ns when this connection became idle or Long.MAX_VALUE if connection is not
* idle.
*/
public synchronized long getIdleStartTimeNs() {
return idleStartTimeNs;
}

/**
* Returns a new server-initiated stream.
*
Expand Down Expand Up @@ -264,7 +243,6 @@ private FramedStream newStream(int associatedStreamId, List<Header> requestHeade
flushHeaders = !out || bytesLeftInWriteWindow == 0L || stream.bytesLeftInWriteWindow == 0L;
if (stream.isOpen()) {
streams.put(streamId, stream);
setIdle(false);
}
}
if (associatedStreamId == 0) {
Expand Down Expand Up @@ -460,7 +438,6 @@ private void close(ErrorCode connectionCode, ErrorCode streamCode) throws IOExce
if (!streams.isEmpty()) {
streamsToClose = streams.values().toArray(new FramedStream[streams.size()]);
streams.clear();
setIdle(false);
}
if (pings != null) {
pingsToCancel = pings.values().toArray(new Ping[pings.size()]);
Expand Down

0 comments on commit 63ae84d

Please sign in to comment.