Enabled the queuing of messages in a linked list again (from the writeOutgoingMessages() method. Removed commented code and comments.

This commit is contained in:
wcrisman
2014-12-29 10:57:06 -08:00
parent b6d57986f2
commit c0a4621a4c

View File

@@ -124,10 +124,6 @@ public class SocketContext extends AbstractSocketContext implements IWebApplicat
private int websocketMessageOpCode = 0; private int websocketMessageOpCode = 0;
/** The currently reading frame's mask key used to decode the frame data. */ /** The currently reading frame's mask key used to decode the frame data. */
private byte[] websocketMessageMaskKey = null; private byte[] websocketMessageMaskKey = null;
/** The streambuffer for the currently sending message. This will be for the current part of the streaming message if websocketStreamingMessage is non-null. */
// private ByteBuffer websocketSendingMessage = null;
/** The streaming message handler which will be set only if the currently sending message is streaming. */
// private IStreamedWebsocketMessage websocketStreamingMessage = null;
/** /**
* SocketContext constructor. * SocketContext constructor.
* @param serverSocketContext The context for the server socket that accepted this socket. * @param serverSocketContext The context for the server socket that accepted this socket.
@@ -140,7 +136,6 @@ public SocketContext(ServerSocketContext serverSocketContext, NetworkListener ne
if(serverSocketContext.getServiceListener().type != IServiceListener.TYPE_SSL) { if(serverSocketContext.getServiceListener().type != IServiceListener.TYPE_SSL) {
this.socketReadBuffer = ByteBuffer.allocate(AbstractSocketContext.BUFFER_SIZE); this.socketReadBuffer = ByteBuffer.allocate(AbstractSocketContext.BUFFER_SIZE);
}//if// }//if//
//TODO: Move code here from caller.
}//SocketContext()// }//SocketContext()//
/** /**
* Gets the next request number and increments the counter. * Gets the next request number and increments the counter.
@@ -207,47 +202,6 @@ protected void close() {
Debug.log(e); Debug.log(e);
}//catch// }//catch//
}//synchronized// }//synchronized//
/* TODO: Remove me. Old code.
try {
if(websocketHandler != null) {
websocketHandler.connectionClosed();
websocketHandler = null;
}//if//
}//try//
catch(Throwable e) {
Debug.log(e);
}//catch//
try {
if(applicationDataMap != null) {
for(IIterator iterator = applicationDataMap.valueIterator(); iterator.hasNext(); ) {
Object next = iterator.next();
//Ensure the code keeps going even if there is a problem cleaning up.//
try {
if(next instanceof ISessionLifecycleAware) ((ISessionLifecycleAware) next).release();
}//try//
catch(Throwable e) {
Debug.log(e);
}//catch//
}//for//
}//if//
}//try//
catch(Throwable e) {
Debug.log(e);
}//catch//
try {if(key != null && key.channel() != null) key.channel().close();} catch(Throwable e) {}
try {if(key != null) key.cancel();} catch(Throwable e) {}
//Clean up after the response and request.//
//try {while(currentOutboundMessage != null) {currentOutboundMessage.close(); currentOutboundMessage = currentOutboundMessage.getNext();}} catch(Throwable e2) {}
// try {if(currentResponse != null) currentResponse.close();} catch(Throwable e2) {}
try {if(currentOutboundMessage != null) currentOutboundMessage.close();} catch(Throwable e2) {}
if(getPassThroughSocketContext() != null) {
getPassThroughSocketContext().close();
}//if//
*/
}//close()// }//close()//
/* (non-Javadoc) /* (non-Javadoc)
* @see com.foundation.web.interfaces.IConnectionContext#getApplicationData(java.lang.String) * @see com.foundation.web.interfaces.IConnectionContext#getApplicationData(java.lang.String)
@@ -387,8 +341,8 @@ protected void writeOutgoingMessages() throws IOException {
try {currentOutboundMessage.close();} catch(Throwable e) {} try {currentOutboundMessage.close();} catch(Throwable e) {}
//Load the next available message.// //Load the next available message.//
//TODO: Swap these lines. //TODO: Swap these lines.
// currentOutboundMessage = currentOutboundMessage.getNext(); currentOutboundMessage = currentOutboundMessage.getNext();
currentOutboundMessage = null; // currentOutboundMessage = null;
if(currentOutboundMessage == null) lastOutboundMessage = null; if(currentOutboundMessage == null) lastOutboundMessage = null;
keepSending = hasPendingWrite() && key.channel().isOpen(); keepSending = hasPendingWrite() && key.channel().isOpen();
outboundMessage = currentOutboundMessage; outboundMessage = currentOutboundMessage;