Rolled back changes to WebServer because they were causing some issues with SSL. Should investigate why the issues are occurring since the newer code should be more correct.

Modified build.xml (ant) to clean before any rebuild all due to having some inconsistency issues in the build.
This commit is contained in:
wcrisman
2014-07-18 12:50:29 -07:00
parent b7a830e6ae
commit 2a6f2f959e
4 changed files with 41 additions and 65 deletions

View File

@@ -94,7 +94,7 @@
</target> </target>
--> -->
<target name="build-all" description="Builds everything including the long running mangler and obfuscator." depends="make-dirs, build-orb-mangler, build-obfuscator, build-view-builders, build-all-src, build-all-bin, build-all-installers"> <target name="build-all" description="Builds everything including the long running mangler and obfuscator." depends="clean, make-dirs, build-orb-mangler, build-obfuscator, build-view-builders, build-all-src, build-all-bin, build-all-installers">
</target> </target>
<target name="build-all-lite" description="Builds everything but the mangler and obfuscator." depends="make-dirs, build-view-builders, build-all-src, build-all-bin, build-all-installers"> <target name="build-all-lite" description="Builds everything but the mangler and obfuscator." depends="make-dirs, build-view-builders, build-all-src, build-all-bin, build-all-installers">
</target> </target>

View File

@@ -1,4 +0,0 @@
Method #0 = com.foundation.tcv.controller.IClientSessionController.createView(long;
Method #1 = com.foundation.tcv.controller.IClientSessionController.processMessages(long;long;com.common.util.IList;boolean;boolean;
Method #2 = com.foundation.tcv.controller.IClientSessionController.getViewSystemMetadata
Method #3 = com.foundation.tcv.controller.IClientSessionController.setCurrentResources([Ljava.lang.String;;

View File

@@ -1,3 +0,0 @@
Method #0 = com.foundation.tcv.controller.IThinServerController.getClientDownloadSize(java.lang.String;
Method #1 = com.foundation.tcv.controller.IThinServerController.getClientDownloadChunk(java.lang.String;int;
Method #2 = com.foundation.tcv.controller.IThinServerController.registerClient(com.common.util.IHashMap;

View File

@@ -99,7 +99,7 @@ public class WebServer {
/** Flag indicating whether the web server is active. The attributes cannot be changed in a thread unsafe manner when this is set. */ /** Flag indicating whether the web server is active. The attributes cannot be changed in a thread unsafe manner when this is set. */
private volatile boolean isStarted = false; private volatile boolean isStarted = false;
/** Whether to report all errors. If false, many networking errors (usually results of browsers terminating connections) will not be reported. */ /** Whether to report all errors. If false, many networking errors (usually results of browsers terminating connections) will not be reported. */
private boolean debug = true; private boolean debug = false;
/** The handler called on to get a result for a bad request. */ /** The handler called on to get a result for a bad request. */
private IWebServerErrorHandler errorHandler = null; private IWebServerErrorHandler errorHandler = null;
/** The maximum length of any request's content block. */ /** The maximum length of any request's content block. */
@@ -315,23 +315,16 @@ public class WebServer {
* Closes the socket context and cleans up. * Closes the socket context and cleans up.
*/ */
protected abstract void close(); protected abstract void close();
protected AbstractSocketContext getRelatedSocketContext() { /**
return relatedSocketContext; * Gets the socket context related to this one (when two are tied together such that data from one immediately is sent to the other).
} * @return The related socket context, or null if none exists (data not forwarded to a remote server).
/* */
protected void setFlags(int flags) { protected AbstractSocketContext getRelatedSocketContext() {return relatedSocketContext;}
this.flags = flags;
}
protected int getFlags() {
return flags;
}
*/
/** /**
* Updates the write flag status. * Updates the write flag status.
* @param requiresWrite Whether a write is required. * @param requiresWrite Whether a write is required.
*/ */
protected void flagWrite(boolean requiresWrite) { protected void flagWrite(boolean requiresWrite) {
synchronized(key) { synchronized(key) {
int ops = key.interestOps(); int ops = key.interestOps();
boolean hasWrite = (ops & SelectionKey.OP_WRITE) != 0; boolean hasWrite = (ops & SelectionKey.OP_WRITE) != 0;
@@ -347,26 +340,12 @@ public class WebServer {
}//if// }//if//
}//else// }//else//
}//synchronized// }//synchronized//
// boolean hasWrite = (flags & SelectionKey.OP_WRITE) != 0;
//
// if(requiresWrite) {
// if(!hasWrite) {
// flags |= SelectionKey.OP_WRITE;
// }//if//
// }//if//
// else {
// if(hasWrite) {
// flags ^= SelectionKey.OP_WRITE;
// }//if//
// }//else//
}//flagWrite()// }//flagWrite()//
/** /**
* Updates the read flag status. * Updates the read flag status.
* @param requiresRead Whether a read is required. * @param requiresRead Whether a read is required.
*/ */
protected void flagRead(boolean requiresRead) { protected void flagRead(boolean requiresRead) {
synchronized(key) { synchronized(key) {
int ops = key.interestOps(); int ops = key.interestOps();
boolean hasRead = (ops & SelectionKey.OP_READ) != 0; boolean hasRead = (ops & SelectionKey.OP_READ) != 0;
@@ -382,19 +361,6 @@ public class WebServer {
}//if// }//if//
}//else// }//else//
}//synchronized// }//synchronized//
// boolean hasRead = (flags & SelectionKey.OP_READ) != 0;
//
// if(requiresRead) {
// if(!hasRead) {
// flags |= SelectionKey.OP_READ;
// }//if//
// }//if//
// else {
// if(hasRead) {
// flags ^= SelectionKey.OP_READ;
// }//if//
// }//else//
}//flagWrite()// }//flagWrite()//
protected void flagReadWrite(boolean requiresRead, boolean requiresWrite) { protected void flagReadWrite(boolean requiresRead, boolean requiresWrite) {
synchronized(key) { synchronized(key) {
@@ -431,19 +397,16 @@ public class WebServer {
synchronized(key) { synchronized(key) {
key.interestOps(SelectionKey.OP_READ | SelectionKey.OP_WRITE); key.interestOps(SelectionKey.OP_READ | SelectionKey.OP_WRITE);
}//synchronized// }//synchronized//
// flags = SelectionKey.OP_READ | SelectionKey.OP_WRITE;
}//flagReadWrite()// }//flagReadWrite()//
protected void flagWriteOnly() { protected void flagWriteOnly() {
synchronized(key) { synchronized(key) {
key.interestOps(SelectionKey.OP_WRITE); key.interestOps(SelectionKey.OP_WRITE);
}//synchronized// }//synchronized//
// flags = SelectionKey.OP_WRITE;
}//flagWriteOnly()// }//flagWriteOnly()//
protected void flagReadOnly() { protected void flagReadOnly() {
synchronized(key) { synchronized(key) {
key.interestOps(SelectionKey.OP_READ); key.interestOps(SelectionKey.OP_READ);
}//synchronized// }//synchronized//
// flags = SelectionKey.OP_READ;
}//flagReadOnly()// }//flagReadOnly()//
}//AbstractSocketContext// }//AbstractSocketContext//
@@ -634,6 +597,7 @@ public class WebServer {
//Debug.log("Posting request content to Git."); //Debug.log("Posting request content to Git.");
pendingMessageBuffer = lastAddedMessageBuffer = message; pendingMessageBuffer = lastAddedMessageBuffer = message;
flagReadWrite(); flagReadWrite();
// flagWrite(true);
}//if// }//if//
else { else {
//TODO: Comment me. //TODO: Comment me.
@@ -1132,6 +1096,7 @@ public class WebServer {
writeClientResponse(); writeClientResponse();
//Set the write flag if we have more to write.// //Set the write flag if we have more to write.//
flagReadWrite(true, pendingOutboundMessage != null); flagReadWrite(true, pendingOutboundMessage != null);
// flagWrite(pendingOutboundMessage != null);
}//synchronized// }//synchronized//
}//if// }//if//
else { else {
@@ -1143,6 +1108,7 @@ public class WebServer {
}//if// }//if//
else { else {
flagReadWrite(); flagReadWrite();
// flagWriteOnly();
}//else// }//else//
}//else// }//else//
}//processCurrentResponse()// }//processCurrentResponse()//
@@ -1309,7 +1275,6 @@ public class WebServer {
if(result && pendingOutboundMessage != null) { 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.// //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(result && !pendingOutboundMessage.getBuffer().hasRemaining()) {
/*
if(!pendingOutboundMessage.loadBuffer()) { if(!pendingOutboundMessage.loadBuffer()) {
if(pendingOutboundMessage.getNext() != null) { if(pendingOutboundMessage.getNext() != null) {
pendingOutboundMessage = pendingOutboundMessage.getNext(); pendingOutboundMessage = pendingOutboundMessage.getNext();
@@ -1323,7 +1288,7 @@ public class WebServer {
pendingOutboundMessage = null; pendingOutboundMessage = null;
lastAddedMessageBuffer = null; lastAddedMessageBuffer = null;
}//if// }//if//
*/ /*
//Attempt to load additional message bytes into the buffer.// //Attempt to load additional message bytes into the buffer.//
boolean couldLoadAdditionalBytes = pendingOutboundMessage.loadBuffer(); boolean couldLoadAdditionalBytes = pendingOutboundMessage.loadBuffer();
@@ -1346,6 +1311,7 @@ public class WebServer {
//Wait until additional message bytes are available.// //Wait until additional message bytes are available.//
result = false; result = false;
}//else if// }//else if//
*/
}//if// }//if//
//If we have an application response pending then send it now.// //If we have an application response pending then send it now.//
@@ -1418,6 +1384,7 @@ public class WebServer {
//Add more content to the buffer.// //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.// //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) { if(key.channel().isOpen() && pendingOutboundMessage != null) {
/*
//Attempt to load additional message bytes into the buffer.// //Attempt to load additional message bytes into the buffer.//
boolean couldLoadAdditionalBytes = pendingOutboundMessage.loadBuffer(); boolean couldLoadAdditionalBytes = pendingOutboundMessage.loadBuffer();
@@ -1439,6 +1406,24 @@ public class WebServer {
//Wait until additional message bytes are available.// //Wait until additional message bytes are available.//
result = false; result = false;
}//else if// }//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.getNext() != null) {
pendingOutboundMessage = pendingOutboundMessage.getNext();
}//if//
else {
//Wait until additional message bytes are available.//
result = false;
}//else//
}//if//
//If the message end has been reached then the buffer will be null.//
if(pendingOutboundMessage.getBuffer() == null) {
pendingOutboundMessage = null;
lastAddedMessageBuffer = null;
}//if//
}//if// }//if//
}//while// }//while//
}//if// }//if//
@@ -1458,21 +1443,23 @@ public class WebServer {
result = false; result = false;
}//if// }//if//
else { else {
/*
if(!pendingOutboundMessage.loadBuffer()) { 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.getNext() != null) { if(pendingOutboundMessage.getNext() != null) {
pendingOutboundMessage = pendingOutboundMessage.getNext(); pendingOutboundMessage = pendingOutboundMessage.getNext();
}//if// }//if//
else { else {
//Wait until additional message bytes are available.//
result = false; result = false;
}//else// }//else//
}//if// }//if//
//If the message end has been reached then the buffer will be null.//
if(pendingOutboundMessage.getBuffer() == null) { if(pendingOutboundMessage.getBuffer() == null) {
pendingOutboundMessage = null; pendingOutboundMessage = null;
lastAddedMessageBuffer = null; lastAddedMessageBuffer = null;
}//if// }//if//
*/ /*
//Attempt to load additional message bytes into the buffer.// //Attempt to load additional message bytes into the buffer.//
boolean couldLoadAdditionalBytes = pendingOutboundMessage.loadBuffer(); boolean couldLoadAdditionalBytes = pendingOutboundMessage.loadBuffer();
@@ -1495,6 +1482,7 @@ public class WebServer {
//Wait until additional message bytes are available.// //Wait until additional message bytes are available.//
result = false; result = false;
}//else if// }//else if//
*/
}//else// }//else//
}//while// }//while//
}//else// }//else//
@@ -1792,6 +1780,7 @@ public class WebServer {
}//if// }//if//
else { else {
flagReadWrite(); flagReadWrite();
// flagWriteOnly();
}//else// }//else//
}//processRequest()// }//processRequest()//
}//SocketContext// }//SocketContext//
@@ -2060,10 +2049,6 @@ public class WebServer {
if(channel != null && !socketClosed && channel.isOpen() && key != null && context != null) { if(channel != null && !socketClosed && channel.isOpen() && key != null && context != null) {
requiresWakeup = true; requiresWakeup = true;
// //Set the flags (either READ/WRITE) for the socket.//
// synchronized(key) {
// key.interestOps(((AbstractSocketContext) context).getFlags());
// }//synchronized//
}//if// }//if//
else if(channel != null && (!channel.isOpen() || socketClosed) && channel instanceof SocketChannel && context instanceof SocketContext) { else if(channel != null && (!channel.isOpen() || socketClosed) && channel instanceof SocketChannel && context instanceof SocketContext) {
cleanupClientChannel((SocketContext) context, (SocketChannel) channel); cleanupClientChannel((SocketContext) context, (SocketChannel) channel);
@@ -2074,12 +2059,10 @@ public class WebServer {
if(activeThreadCount-- != maxThreadCount) { if(activeThreadCount-- != maxThreadCount) {
loop = false; loop = false;
// if(requiresWakeup) { if(requiresWakeup) {
// selector.wakeup(); selector.wakeup();
// }//if// }//if//
}//if// }//if//
selector.wakeup();
}//synchronized// }//synchronized//
}//finally// }//finally//
}//else if// }//else if//
@@ -3304,7 +3287,7 @@ private boolean processClientRequest(SocketContext context, final Request reques
//Save the session immediately since the requested resource might not indicate to the application that the session was updated.// //Save the session immediately since the requested resource might not indicate to the application that the session was updated.//
//Note: We shouldn't have any problems with multiple threads from the same client each creating their own session data since every browser should start with a single thread requesting a single resource before multiple threads are used to download all the child resources.// //Note: We shouldn't have any problems with multiple threads from the same client each creating their own session data since every browser should start with a single thread requesting a single resource before multiple threads are used to download all the child resources.//
if(session != null && hasNewSessionData) { if(hasNewSessionData && session != null) {
//Store the session store in the db.// //Store the session store in the db.//
session.updateRepository(); session.updateRepository();
}//if// }//if//