Switched the WebServer to detecting which flags to apply to a socket based on whether there is a pending write or remaining byte in the encrypted write buffer (likely a cause of the bug).
This commit is contained in:
@@ -1934,7 +1934,7 @@ public class WebServer {
|
||||
* @see com.foundation.web.server.WebServer.AbstractSocketContext#hasPendingWrite()
|
||||
*/
|
||||
protected boolean hasPendingWrite() {
|
||||
return pendingOutboundMessage != null;
|
||||
return pendingOutboundMessage != null || (encryptedWriteBuffer != null && encryptedWriteBuffer.hasRemaining());
|
||||
}//hasPendingWrite()//
|
||||
/* (non-Javadoc)
|
||||
* @see com.foundation.web.interfaces.IConnectionContext#upgradeToWebsocket(java.lang.String, long, com.foundation.web.interfaces.WebsocketHandler)
|
||||
@@ -2252,8 +2252,8 @@ public class WebServer {
|
||||
synchronized(selectionKey) {
|
||||
if(selectionKey.isValid()) {
|
||||
//Always flag the socket for reading, only flag the socket for writing if a pending write operation exists.//
|
||||
//selectionKey.interestOps(SelectionKey.OP_READ | (((AbstractSocketContext) context).hasPendingWrite() ? SelectionKey.OP_WRITE : 0));
|
||||
selectionKey.interestOps(((AbstractSocketContext) context).flags);
|
||||
selectionKey.interestOps(SelectionKey.OP_READ | (((AbstractSocketContext) context).hasPendingWrite() ? SelectionKey.OP_WRITE : 0));
|
||||
//selectionKey.interestOps(((AbstractSocketContext) context).flags);
|
||||
}//if//
|
||||
else {
|
||||
Debug.log(new RuntimeException("Woops! Somehow the selection key isn't valid, but the socket isn't closed either!"));
|
||||
|
||||
Reference in New Issue
Block a user