minor cleanup of variable names and ordering

git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@3015 7e9141cc-0065-0410-87d8-b60c137991c4
This commit is contained in:
Greg Wilkins 2011-04-14 01:45:36 +00:00
parent eee81312e4
commit 975ee04df4
1 changed files with 15 additions and 16 deletions

View File

@ -493,7 +493,7 @@ public class WebSocketConnectionD06 extends AbstractConnection implements WebSoc
public void onFrame(byte flags, byte opcode, Buffer buffer) public void onFrame(byte flags, byte opcode, Buffer buffer)
{ {
boolean more=(flags&0x8)==0; boolean lastFrame = isLastFrame(flags);
synchronized(WebSocketConnectionD06.this) synchronized(WebSocketConnectionD06.this)
{ {
@ -528,7 +528,7 @@ public class WebSocketConnectionD06 extends AbstractConnection implements WebSoc
if (_utf8.append(buffer.array(),buffer.getIndex(),buffer.length(),_connection.getMaxTextMessageSize())) if (_utf8.append(buffer.array(),buffer.getIndex(),buffer.length(),_connection.getMaxTextMessageSize()))
{ {
// If this is the last fragment, deliver the text buffer // If this is the last fragment, deliver the text buffer
if (more && _onTextMessage!=null) if (lastFrame && _onTextMessage!=null)
{ {
_opcode=-1; _opcode=-1;
String msg =_utf8.toString(); String msg =_utf8.toString();
@ -542,7 +542,6 @@ public class WebSocketConnectionD06 extends AbstractConnection implements WebSoc
_utf8.reset(); _utf8.reset();
_opcode=-1; _opcode=-1;
} }
} }
else if (_opcode>=0 && _connection.getMaxBinaryMessageSize()>=0) else if (_opcode>=0 && _connection.getMaxBinaryMessageSize()>=0)
{ {
@ -557,7 +556,7 @@ public class WebSocketConnectionD06 extends AbstractConnection implements WebSoc
_aggregate.put(buffer); _aggregate.put(buffer);
// If this is the last fragment, deliver // If this is the last fragment, deliver
if (!more && _onBinaryMessage!=null) if (lastFrame && _onBinaryMessage!=null)
{ {
try try
{ {
@ -606,7 +605,12 @@ public class WebSocketConnectionD06 extends AbstractConnection implements WebSoc
{ {
if(_onTextMessage!=null) if(_onTextMessage!=null)
{ {
if (more) if (lastFrame)
{
// Deliver the message
_onTextMessage.onMessage(buffer.toString(StringUtil.__UTF8));
}
else
{ {
if (_connection.getMaxTextMessageSize()>=0) if (_connection.getMaxTextMessageSize()>=0)
{ {
@ -621,11 +625,6 @@ public class WebSocketConnectionD06 extends AbstractConnection implements WebSoc
} }
} }
} }
else
{
// Deliver the message
_onTextMessage.onMessage(buffer.toString(StringUtil.__UTF8));
}
} }
break; break;
} }
@ -634,7 +633,11 @@ public class WebSocketConnectionD06 extends AbstractConnection implements WebSoc
{ {
if (_onBinaryMessage!=null) if (_onBinaryMessage!=null)
{ {
if (more) if (lastFrame)
{
_onBinaryMessage.onMessage(array,buffer.getIndex(),buffer.length());
}
else
{ {
if (_connection.getMaxBinaryMessageSize()>=0) if (_connection.getMaxBinaryMessageSize()>=0)
{ {
@ -654,10 +657,6 @@ public class WebSocketConnectionD06 extends AbstractConnection implements WebSoc
} }
} }
} }
else
{
_onBinaryMessage.onMessage(array,buffer.getIndex(),buffer.length());
}
} }
} }
} }