307898 cleanup

git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@1439 7e9141cc-0065-0410-87d8-b60c137991c4
This commit is contained in:
Greg Wilkins 2010-04-02 08:04:11 +00:00
parent f1c3f3e42c
commit 05da23b3c6
1 changed files with 13 additions and 11 deletions

View File

@ -62,6 +62,7 @@ public class WebSocketConnection implements Connection, WebSocket.Outbound
}
});
// TODO should these be AsyncEndPoint checks/calls?
if (_endp instanceof SelectChannelEndPoint)
{
final SelectChannelEndPoint scep=(SelectChannelEndPoint)_endp;
@ -115,9 +116,7 @@ public class WebSocketConnection implements Connection, WebSocket.Outbound
if (_endp.isOpen())
{
_idle.access(_endp);
if (!_generator.isBufferEmpty() && _endp instanceof AsyncEndPoint)
((AsyncEndPoint)_endp).scheduleWrite();
checkWriteable();
}
else
// TODO - not really the best way
@ -150,8 +149,7 @@ public class WebSocketConnection implements Connection, WebSocket.Outbound
{
_generator.addFrame(WebSocket.SENTINEL_FRAME,content,_maxIdleTimeMs);
_generator.flush();
if (!_generator.isBufferEmpty() && _endp instanceof AsyncEndPoint)
((AsyncEndPoint)_endp).scheduleWrite();
checkWriteable();
_idle.access(_endp);
}
@ -159,8 +157,7 @@ public class WebSocketConnection implements Connection, WebSocket.Outbound
{
_generator.addFrame(frame,content,_maxIdleTimeMs);
_generator.flush();
if (!_generator.isBufferEmpty() && _endp instanceof AsyncEndPoint)
((AsyncEndPoint)_endp).scheduleWrite();
checkWriteable();
_idle.access(_endp);
}
@ -168,8 +165,7 @@ public class WebSocketConnection implements Connection, WebSocket.Outbound
{
_generator.addFrame(frame,content,_maxIdleTimeMs);
_generator.flush();
if (!_generator.isBufferEmpty() && _endp instanceof AsyncEndPoint)
((AsyncEndPoint)_endp).scheduleWrite();
checkWriteable();
_idle.access(_endp);
}
@ -177,8 +173,7 @@ public class WebSocketConnection implements Connection, WebSocket.Outbound
{
_generator.addFrame(frame,content,offset,length,_maxIdleTimeMs);
_generator.flush();
if (!_generator.isBufferEmpty() && _endp instanceof AsyncEndPoint)
((AsyncEndPoint)_endp).scheduleWrite();
checkWriteable();
_idle.access(_endp);
}
@ -199,6 +194,13 @@ public class WebSocketConnection implements Connection, WebSocket.Outbound
{
_parser.fill(buffer);
}
private void checkWriteable()
{
if (!_generator.isBufferEmpty() && _endp instanceof AsyncEndPoint)
((AsyncEndPoint)_endp).scheduleWrite();
}
private interface IdleCheck
{