From c0a4621a4c8b493416a3a240a4848b23d1a301e3 Mon Sep 17 00:00:00 2001 From: wcrisman Date: Mon, 29 Dec 2014 10:57:06 -0800 Subject: [PATCH] Enabled the queuing of messages in a linked list again (from the writeOutgoingMessages() method. Removed commented code and comments. --- .../foundation/web/server/SocketContext.java | 50 +------------------ 1 file changed, 2 insertions(+), 48 deletions(-) diff --git a/Foundation Web Core/src/com/foundation/web/server/SocketContext.java b/Foundation Web Core/src/com/foundation/web/server/SocketContext.java index 7b5411b..831679b 100644 --- a/Foundation Web Core/src/com/foundation/web/server/SocketContext.java +++ b/Foundation Web Core/src/com/foundation/web/server/SocketContext.java @@ -124,10 +124,6 @@ public class SocketContext extends AbstractSocketContext implements IWebApplicat private int websocketMessageOpCode = 0; /** The currently reading frame's mask key used to decode the frame data. */ 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. * @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) { this.socketReadBuffer = ByteBuffer.allocate(AbstractSocketContext.BUFFER_SIZE); }//if// -//TODO: Move code here from caller. }//SocketContext()// /** * Gets the next request number and increments the counter. @@ -207,47 +202,6 @@ protected void close() { Debug.log(e); }//catch// }//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()// /* (non-Javadoc) * @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) {} //Load the next available message.// //TODO: Swap these lines. -// currentOutboundMessage = currentOutboundMessage.getNext(); - currentOutboundMessage = null; + currentOutboundMessage = currentOutboundMessage.getNext(); +// currentOutboundMessage = null; if(currentOutboundMessage == null) lastOutboundMessage = null; keepSending = hasPendingWrite() && key.channel().isOpen(); outboundMessage = currentOutboundMessage;