From 1147864416d4c1e4c4b8a5e87af5969e0766259a Mon Sep 17 00:00:00 2001 From: wcrisman Date: Fri, 18 Jul 2014 14:30:59 -0700 Subject: [PATCH] Re-enabled the old code with the new fix for the SSL failure. --- .../com/foundation/web/server/WebServer.java | 25 +++++++++++-------- 1 file changed, 15 insertions(+), 10 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 03b96c7..9aa8232 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,7 @@ 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,13 +1289,14 @@ 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).// - if(pendingOutboundMessage.getBuffer() == null) { + //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(); @@ -1312,7 +1313,7 @@ public class WebServer { //Wait until additional message bytes are available.// result = false; }//else if// -*/ + }//if// //If we have an application response pending then send it now.// @@ -1385,12 +1386,13 @@ 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).// - if(pendingOutboundMessage.getBuffer() == null) { + //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(); @@ -1407,7 +1409,7 @@ public class WebServer { //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.// @@ -1425,6 +1427,7 @@ public class WebServer { pendingOutboundMessage = null; lastAddedMessageBuffer = null; }//if// +*/ }//if// }//while// }//if// @@ -1444,6 +1447,7 @@ 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) { @@ -1460,13 +1464,14 @@ 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).// - if(pendingOutboundMessage.getBuffer() == null) { + //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(); @@ -1483,7 +1488,7 @@ public class WebServer { //Wait until additional message bytes are available.// result = false; }//else if// -*/ + }//else// }//while// }//else//