From 75224976340966a27289d9b99bafe204909c576f Mon Sep 17 00:00:00 2001 From: wcrisman Date: Fri, 18 Jul 2014 14:50:21 -0700 Subject: [PATCH] Reverted last change and removed new code completely (wasn't working - no reason to figure out why since it was now more complicated than the code it intended to clean up). --- .../com/foundation/web/server/WebServer.java | 78 ------------------- 1 file changed, 78 deletions(-) diff --git a/Foundation Web Core/src/com/foundation/web/server/WebServer.java b/Foundation Web Core/src/com/foundation/web/server/WebServer.java index 9aa8232..88831d8 100644 --- a/Foundation Web Core/src/com/foundation/web/server/WebServer.java +++ b/Foundation Web Core/src/com/foundation/web/server/WebServer.java @@ -1275,7 +1275,6 @@ public class WebServer { if(result && pendingOutboundMessage != null) { //Check to see if the outbound message is prepared to send more content. For chunked transfers the outbound message may be waiting for additional content from another stream and we should return later.// if(result && !pendingOutboundMessage.getBuffer().hasRemaining()) { -/* if(!pendingOutboundMessage.loadBuffer()) { if(pendingOutboundMessage.getBuffer() == null && pendingOutboundMessage.getNext() != null) { pendingOutboundMessage = pendingOutboundMessage.getNext(); @@ -1289,31 +1288,6 @@ public class WebServer { pendingOutboundMessage = null; lastAddedMessageBuffer = null; }//if// -*/ - - //Attempt to load additional message bytes into the buffer.// - boolean couldLoadAdditionalBytes = pendingOutboundMessage.loadBuffer(); - - //The buffer will be set to null if there are no more bytes to be read from the stream (ever).// - //Note that the buffer could be null, but we have more bytes to be written.// - if(!couldLoadAdditionalBytes && pendingOutboundMessage.getBuffer() == null) { - //Load the next pending outbound message in the chain. This is currently only used for content being passed through to another process via a second socket.// - if(pendingOutboundMessage.getNext() != null) { - pendingOutboundMessage = pendingOutboundMessage.getNext(); - }//if// - //Tell the caller that all messages have been sent.// - else { - pendingOutboundMessage = null; - lastAddedMessageBuffer = null; - result = true; - }//else// - }//if// - //Note: Currently this will never happen since it is a waste of CPU cycles. See comments in StreamedContent's class javadocs. We'd need to remove the write flag from the socket and listen for a read flag on the stream before re-setting the write flag on the socket.// - else if(!couldLoadAdditionalBytes) { - //Wait until additional message bytes are available.// - result = false; - }//else if// - }//if// //If we have an application response pending then send it now.// @@ -1386,31 +1360,6 @@ public class WebServer { //Add more content to the buffer.// //Note: Do this even if the last encrypted write buffer could not be fully sent - so that when it is sent there will be outbound message content.// if(key.channel().isOpen() && pendingOutboundMessage != null) { - - //Attempt to load additional message bytes into the buffer.// - boolean couldLoadAdditionalBytes = pendingOutboundMessage.loadBuffer(); - - //The buffer will be set to null if there are no more bytes to be read from the stream (ever).// - //Note that the buffer could be null, but we have more bytes to be written.// - if(!couldLoadAdditionalBytes && pendingOutboundMessage.getBuffer() == null) { - //Load the next pending outbound message in the chain. This is currently only used for content being passed through to another process via a second socket.// - if(pendingOutboundMessage.getNext() != null) { - pendingOutboundMessage = pendingOutboundMessage.getNext(); - }//if// - //Tell the caller that all messages have been sent.// - else { - pendingOutboundMessage = null; - lastAddedMessageBuffer = null; - result = true; - }//else// - }//if// - //Note: Currently this will never happen since it is a waste of CPU cycles. See comments in StreamedContent's class javadocs. We'd need to remove the write flag from the socket and listen for a read flag on the stream before re-setting the write flag on the socket.// - else if(!couldLoadAdditionalBytes) { - //Wait until additional message bytes are available.// - result = false; - }//else if// -/* - if(!pendingOutboundMessage.loadBuffer()) { //Load the next pending outbound message in the chain. This is currently only used for content being passed through to another process via a second socket.// if(pendingOutboundMessage.getBuffer() == null && pendingOutboundMessage.getNext() != null) { @@ -1427,7 +1376,6 @@ public class WebServer { pendingOutboundMessage = null; lastAddedMessageBuffer = null; }//if// -*/ }//if// }//while// }//if// @@ -1447,7 +1395,6 @@ public class WebServer { result = false; }//if// else { - /* if(!pendingOutboundMessage.loadBuffer()) { //Load the next pending outbound message in the chain. This is currently only used for content being passed through to another process via a second socket.// if(pendingOutboundMessage.getBuffer() == null && pendingOutboundMessage.getNext() != null) { @@ -1464,31 +1411,6 @@ public class WebServer { pendingOutboundMessage = null; lastAddedMessageBuffer = null; }//if// - */ - - //Attempt to load additional message bytes into the buffer.// - boolean couldLoadAdditionalBytes = pendingOutboundMessage.loadBuffer(); - - //The buffer will be set to null if there are no more bytes to be read from the stream (ever).// - //Note that the buffer could be null, but we have more bytes to be written.// - if(!couldLoadAdditionalBytes && pendingOutboundMessage.getBuffer() == null) { - //Load the next pending outbound message in the chain. This is currently only used for content being passed through to another process via a second socket.// - if(pendingOutboundMessage.getNext() != null) { - pendingOutboundMessage = pendingOutboundMessage.getNext(); - }//if// - //Tell the caller that all messages have been sent.// - else { - pendingOutboundMessage = null; - lastAddedMessageBuffer = null; - result = true; - }//else// - }//if// - //Note: Currently this will never happen since it is a waste of CPU cycles. See comments in StreamedContent's class javadocs. We'd need to remove the write flag from the socket and listen for a read flag on the stream before re-setting the write flag on the socket.// - else if(!couldLoadAdditionalBytes) { - //Wait until additional message bytes are available.// - result = false; - }//else if// - }//else// }//while// }//else//