Making BlockHeadClient timeouts more sane

This commit is contained in:
Joakim Erdfelt 2012-07-11 09:53:18 -07:00
parent d3b599d67c
commit 0d1fee5906
2 changed files with 4 additions and 5 deletions

View File

@ -44,8 +44,6 @@ public class WebSocketServletRFCTest
public void registerWebSockets(WebSocketServerFactory factory)
{
factory.register(RFCSocket.class);
factory.getPolicy().setMaxIdleTime(800);
}
}

View File

@ -221,12 +221,13 @@ public class BlockheadClient implements Parser.Listener
int startCount = incomingFrameQueue.size();
ByteBuffer buf = bufferPool.acquire(policy.getBufferSize(),false);
BufferUtil.clear(buf);
BufferUtil.clearToFill(buf);
try
{
long msDur = TimeUnit.MILLISECONDS.convert(timeoutDuration,timeoutUnit);
long now = System.currentTimeMillis();
long expireOn = now + TimeUnit.MILLISECONDS.convert(timeoutDuration,timeoutUnit);
LOG.debug("Now: {} - expireOn: {}",now,expireOn);
long expireOn = now + msDur;
LOG.debug("Now: {} - expireOn: {} ({} ms)",now,expireOn,msDur);
int len = 0;
while (incomingFrameQueue.size() < (startCount + expectedCount))