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

Mike Heath resolved DIRMINA-525.
--------------------------------

    Resolution: Fixed

I've committed this change.  Thanks Geoff for the patch!

> AbstractIoSession.increaseWrittenBytesAndMessages does not update 
> writtenBytes for FileRegion
> ---------------------------------------------------------------------------------------------
>
>                 Key: DIRMINA-525
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-525
>             Project: MINA
>          Issue Type: Bug
>          Components: Core
>         Environment: jdk1.6.0_03 Linux x64
>            Reporter: Geoff Cadien
>            Assignee: Mike Heath
>             Fix For: 2.0.0-M1
>
>
> AbstractIoSession.increaseWrittenBytesAndMessages only updates 
> writtenMessages and not writtenBytes for a FileRegion.  
> Below is a patch that fixes the problem but I'm not sure if it is correct.  
> When the WriteRequest contains an IoBuffer a check is made to see if the 
> IoBuffer has any remaining bytes and only updates writtenBytes if it does.  
> I've never seen this method called when only part of a FileRegion is sent and 
> I'm sure how it could be because it seems that 
> increaseWrittenBytesAndMessages is only called from fireMessageSent.
> Index: AbstractIoSession.java
> ===================================================================
> --- AbstractIoSession.java      (revision 616815)
> +++ AbstractIoSession.java      (working copy)
> @@ -541,6 +541,12 @@
>              } else {
>                  increaseWrittenMessages(currentTime);
>              }
> +        } else if (message instanceof FileRegion) {
> +            FileRegion region = (FileRegion) message;
> +            if (region.getCount() == 0) {
> +                increaseWrittenBytes(region.getWrittenBytes(), currentTime);
> +                increaseWrittenMessages(currentTime);
> +            } 
>          } else {
>              increaseWrittenMessages(currentTime);
>          }

-- 
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