aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Becker2013-04-11 06:28:06 (EDT)
committerThomas Becker2013-04-11 06:28:33 (EDT)
commit7ed3a343ad6084f2e24c056cf98988ffcb0a2daa (patch)
tree3d821f803651a3b1e83772aa877901a8b8212746
parent8a0ba267c16f3f1fc7f90dadb2d6d2898b2f8fa8 (diff)
downloadorg.eclipse.jetty.project-7ed3a343ad6084f2e24c056cf98988ffcb0a2daa.zip
org.eclipse.jetty.project-7ed3a343ad6084f2e24c056cf98988ffcb0a2daa.tar.gz
org.eclipse.jetty.project-7ed3a343ad6084f2e24c056cf98988ffcb0a2daa.tar.bz2
405449 spdy improve handling of duplicate stream Ids
-rw-r--r--jetty-spdy/spdy-core/src/main/java/org/eclipse/jetty/spdy/StandardSession.java22
1 files changed, 8 insertions, 14 deletions
diff --git a/jetty-spdy/spdy-core/src/main/java/org/eclipse/jetty/spdy/StandardSession.java b/jetty-spdy/spdy-core/src/main/java/org/eclipse/jetty/spdy/StandardSession.java
index a0bda51..30dc870 100644
--- a/jetty-spdy/spdy-core/src/main/java/org/eclipse/jetty/spdy/StandardSession.java
+++ b/jetty-spdy/spdy-core/src/main/java/org/eclipse/jetty/spdy/StandardSession.java
@@ -244,7 +244,6 @@ public class StandardSession implements ISession, Parser.Listener, Dumpable
@Override
public PingResultInfo ping(PingInfo pingInfo) throws ExecutionException, InterruptedException, TimeoutException
{
- //TODO: find a better name for PingResultInfo
FuturePromise<PingResultInfo> result = new FuturePromise<>();
ping(pingInfo, result);
if (pingInfo.getTimeout() > 0)
@@ -548,10 +547,10 @@ public class StandardSession implements ISession, Parser.Listener, Dumpable
int maxConcurrentStreams = maxConcurrentLocalStreams;
if (maxConcurrentStreams > -1 && oldStreamCountValue >= maxConcurrentStreams)
{
- String msg = String.format("Max concurrent local streams (%d) exceeded.",
+ String message = String.format("Max concurrent local streams (%d) exceeded.",
maxConcurrentStreams);
- LOG.debug(msg);
- promise.failed(new SPDYException(msg));
+ LOG.debug(message);
+ promise.failed(new SPDYException(message));
return null;
}
if (localStreamCount.compareAndSet(oldStreamCountValue, oldStreamCountValue + 1))
@@ -561,22 +560,17 @@ public class StandardSession implements ISession, Parser.Listener, Dumpable
if (streams.putIfAbsent(streamId, stream) != null)
{
- //TODO: fail promise
+ String message = "Duplicate stream id " + streamId;
+ IllegalStateException duplicateIdException = new IllegalStateException(message);
+ promise.failed(duplicateIdException);
if (local)
{
localStreamCount.decrementAndGet();
- throw new IllegalStateException("Duplicate stream id " + streamId);
+ throw duplicateIdException;
}
RstInfo rstInfo = new RstInfo(streamId, StreamStatus.PROTOCOL_ERROR);
LOG.debug("Duplicate stream, {}", rstInfo);
- try
- {
- rst(rstInfo); //TODO: non blocking reset or find the reason why blocking is used
- }
- catch (InterruptedException | ExecutionException | TimeoutException e)
- {
- e.printStackTrace(); // TODO: really catch???
- }
+ rst(rstInfo, new Callback.Adapter()); // We don't care (too much) if the reset fails.
return null;
}
else