Fixed bug in the internalProcessResponses() in SocketContext where a message was flagged as needing to send more data because of already encrypted but unsent data, but was not properly sending the data because the currentOutboundMessage was closed and cleared.
This commit is contained in:
@@ -726,26 +726,32 @@ private void loadNextWebsocketMessage() {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private synchronized void internalProcessResponses() {
|
private synchronized void internalProcessResponses() {
|
||||||
boolean finishedSending = true;
|
boolean doneSending = false;
|
||||||
|
|
||||||
//Keep sending responses while the buffers are not full and there is another response to send.//
|
//Keep sending responses while the buffers are not full and there is another response to send.//
|
||||||
while(finishedSending) {
|
while(!doneSending) {
|
||||||
|
boolean messageSent = true;
|
||||||
|
|
||||||
//If the socket is open then send the next buffer of data.//
|
//If the socket is open then send the next buffer of data.//
|
||||||
if(key.channel().isOpen()) {
|
if(key.channel().isOpen()) {
|
||||||
//Send the pending response object's prepared buffer of data.//
|
//Send the pending response object's prepared buffer of data.//
|
||||||
finishedSending = writeClientBoundMessage();
|
messageSent = writeClientBoundMessage();
|
||||||
}//if//
|
}//if//
|
||||||
|
|
||||||
//Close the response if successfully sent, or if the socket is closed.//
|
//Close the response if successfully sent, or if the socket is closed.//
|
||||||
if(finishedSending || !key.channel().isOpen()) {
|
if((messageSent || !key.channel().isOpen()) && currentOutboundMessage != null) {
|
||||||
try {currentOutboundMessage.close();} catch(Throwable e) {}
|
try {currentOutboundMessage.close();} catch(Throwable e) {}
|
||||||
}//if//
|
}//if//
|
||||||
|
|
||||||
//If we finished sending the current response then load the next one.//
|
//If we finished sending the current response then load the next one.//
|
||||||
if(finishedSending) {
|
if(messageSent) {
|
||||||
//TODO: Queue up the next outbound message.
|
//TODO: Queue up the next outbound message.
|
||||||
currentOutboundMessage = null;
|
currentOutboundMessage = null;
|
||||||
}//if//
|
}//if//
|
||||||
|
|
||||||
|
if(currentOutboundMessage == null) {
|
||||||
|
doneSending = true;
|
||||||
|
}//if//
|
||||||
}//while//
|
}//while//
|
||||||
|
|
||||||
// //Keep sending responses while the buffers are not full and there is another response to send.//
|
// //Keep sending responses while the buffers are not full and there is another response to send.//
|
||||||
|
|||||||
Reference in New Issue
Block a user