Jetty9 - SPDY: computing return value for write() and small optimization in fill().

This commit is contained in:
Simone Bordet 2012-07-31 16:17:24 +02:00
parent 50ac775bf5
commit 78802c35c2
1 changed files with 4 additions and 1 deletions

View File

@ -78,6 +78,8 @@ public class SPDYAsyncConnection extends AbstractAsyncConnection implements Cont
{ {
try try
{ {
if (endPoint.isInputShutdown())
return -1;
return endPoint.fill(buffer); return endPoint.fill(buffer);
} }
catch (IOException x) catch (IOException x)
@ -91,8 +93,9 @@ public class SPDYAsyncConnection extends AbstractAsyncConnection implements Cont
public int write(ByteBuffer buffer, final Callback<StandardSession.FrameBytes> callback, StandardSession.FrameBytes context) public int write(ByteBuffer buffer, final Callback<StandardSession.FrameBytes> callback, StandardSession.FrameBytes context)
{ {
AsyncEndPoint endPoint = getEndPoint(); AsyncEndPoint endPoint = getEndPoint();
int remaining = buffer.remaining();
endPoint.write(context, callback, buffer); endPoint.write(context, callback, buffer);
return -1; //TODO: void or have endPoint.write return int return remaining - buffer.remaining();
} }
@Override @Override