From 78802c35c203d6d2a1b084ca8035e819872c64e8 Mon Sep 17 00:00:00 2001 From: Simone Bordet Date: Tue, 31 Jul 2012 16:17:24 +0200 Subject: [PATCH] Jetty9 - SPDY: computing return value for write() and small optimization in fill(). --- .../java/org/eclipse/jetty/spdy/SPDYAsyncConnection.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/jetty-spdy/spdy-jetty/src/main/java/org/eclipse/jetty/spdy/SPDYAsyncConnection.java b/jetty-spdy/spdy-jetty/src/main/java/org/eclipse/jetty/spdy/SPDYAsyncConnection.java index 83c3cc364a1..c3f1e81998d 100644 --- a/jetty-spdy/spdy-jetty/src/main/java/org/eclipse/jetty/spdy/SPDYAsyncConnection.java +++ b/jetty-spdy/spdy-jetty/src/main/java/org/eclipse/jetty/spdy/SPDYAsyncConnection.java @@ -78,6 +78,8 @@ public class SPDYAsyncConnection extends AbstractAsyncConnection implements Cont { try { + if (endPoint.isInputShutdown()) + return -1; return endPoint.fill(buffer); } catch (IOException x) @@ -91,8 +93,9 @@ public class SPDYAsyncConnection extends AbstractAsyncConnection implements Cont public int write(ByteBuffer buffer, final Callback callback, StandardSession.FrameBytes context) { AsyncEndPoint endPoint = getEndPoint(); + int remaining = buffer.remaining(); endPoint.write(context, callback, buffer); - return -1; //TODO: void or have endPoint.write return int + return remaining - buffer.remaining(); } @Override