Fixed bug where a buffer not entirely flushed by the I/O system was called skip() twice.

git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@1441 7e9141cc-0065-0410-87d8-b60c137991c4
This commit is contained in:
Simone Bordet 2010-04-02 10:28:17 +00:00
parent 5118ba49ac
commit 9e4f1fd335
2 changed files with 8 additions and 6 deletions

View File

@ -127,12 +127,8 @@ public class WebSocketGenerator
throw new IOException("Closed");
if (_buffer!=null)
{
int flushed =_endp.flush(_buffer);
if (flushed>0)
_buffer.skip(flushed);
return flushed;
}
return _endp.flush(_buffer);
return 0;
}

View File

@ -64,6 +64,9 @@ public class WebSocketMessageTest extends TestCase
"\r\n").getBytes("ISO-8859-1"));
output.flush();
// Make sure the read times out if there are problems with the implementation
socket.setSoTimeout(1000);
InputStream input = socket.getInputStream();
BufferedReader reader = new BufferedReader(new InputStreamReader(input, "ISO-8859-1"));
String responseLine = reader.readLine();
@ -113,6 +116,9 @@ public class WebSocketMessageTest extends TestCase
"\r\n").getBytes("ISO-8859-1"));
output.flush();
// Make sure the read times out if there are problems with the implementation
socket.setSoTimeout(1000);
InputStream input = socket.getInputStream();
BufferedReader reader = new BufferedReader(new InputStreamReader(input, "ISO-8859-1"));
String responseLine = reader.readLine();