[ 
https://issues.apache.org/jira/browse/DIRMINA-671?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Emmanuel Lecharny updated DIRMINA-671:
--------------------------------------

    Fix Version/s: 3.0.0-M1

(I moved it to 3.0)

This is not a bug, it's a "feature". Ok, call it a bloody hack. For some 
reason, in order to get statistics updated (more precisely, the number of sent 
messages), you _have_ to send an empty message. This is what is done here.

I 200% agree that it's totally useless, bad, ugly, disgusting. We should be 
able to update the statistics using the WriteFuture created when we call the 
session.write(). More important, the statistics should _not_ be handled before 
the chain, but should be a Filter.

> AbstractPollingIoProcessor
> --------------------------
>
>                 Key: DIRMINA-671
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-671
>             Project: MINA
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 2.0.0-M4
>            Reporter: Aaron Wald
>            Priority: Minor
>             Fix For: 3.0.0-M1
>
>
> In flushNow() it appears to me that when writeBuffer is called, when the 
> buffer is completely sent, we will always come into the buffer isn't empty 
> check. 
>  if (message instanceof IoBuffer) {
>                    localWrittenBytes = writeBuffer(
>                             session, req, hasFragmentation,
>                             maxWrittenBytes - writtenBytes,
>                             currentTime);
>                     if (localWrittenBytes > 0 && 
> ((IoBuffer)message).hasRemaining() ) {
>                       // the buffer isn't empty, we re-interest it in writing 
>                       writtenBytes += localWrittenBytes;      
>                       setInterestedInWrite(session, true);
>                         return false;
>                     }
>                 }
> In writeBuffer this is done:
>         if (!buf.hasRemaining() ||
>                 !hasFragmentation && localWrittenBytes != 0) {
>             // Buffer has been sent, clear the current request.
>             buf.reset();
>             fireMessageSent(session, req);
>         }
> fireMessageSent clears the write request, so when we come back after select() 
> we wont double send data but it seems like twice the work is being done.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to