mina-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Emmanuel Lecharny (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (DIRMINA-1033) Expose METADATA parameter for NioDatagramSession
Date Thu, 03 Mar 2016 10:46:18 GMT

    [ https://issues.apache.org/jira/browse/DIRMINA-1033?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15177656#comment-15177656
] 

Emmanuel Lecharny commented on DIRMINA-1033:
--------------------------------------------

Actually, I think something like :

{noformat}
    
    /**
     * Let the user change the way we handle fragmentation. If set to <tt>false</tt>,
the 
     * decode() method will not check the TransportMetadata fragmentation capability
     *  
     * @param handleFragment The flag to set.
     */
    public void setTransportMetadataFragmentation(boolean transportMetadataFragmentation)
{
        this.transportMetadataFragmentation = transportMetadataFragmentation;
    }
{noformat}

with :

{noformat}
...
    /** A flag set to true if we handle fragmentation accordingly to the TransportMetadata
setting. 
     * It can be set to false if needed (UDP with fragments, for instance). the default value
is 'true'
     */
    private boolean transportMetadataFragmentation = true;
...
    public void decode(IoSession session, IoBuffer in, ProtocolDecoderOutput out) throws Exception
{
        if (transportMetadataFragmentation && !session.getTransportMetadata().hasFragmentation())
{
            while (in.hasRemaining()) {
                if (!doDecode(session, in, out)) {
                    break;
                }
            }

            return;
        }
...
{noformat}

is better. the user just has to set the flag to false when instanciating the decoder.

> Expose METADATA parameter for NioDatagramSession
> ------------------------------------------------
>
>                 Key: DIRMINA-1033
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-1033
>             Project: MINA
>          Issue Type: Bug
>          Components: Transport
>    Affects Versions: 2.0.13
>         Environment: Centos 7, Windows 7
>            Reporter: Tunca Tunc
>            Priority: Minor
>              Labels: easyfix
>             Fix For: 2.0.14
>
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> The CumulativeProtocolHandler doesn't accumulate for UDP transport.
> It's because METADATA for NioDatagramSession is created as
> static final TransportMetadata METADATA = new DefaultTransportMetadata("nio", "datagram",
true, false, InetSocketAddress.class, DatagramSessionConfig.class, IoBuffer.class);
> Where 4th parameter is fragmentation parameter. Thus it thinks there are no fragmentation
for UDP transport.
> NioDatagramSession METADATA should be created as:
>     static final TransportMetadata METADATA = new DefaultTransportMetadata("nio", "datagram",
true, true,
>             InetSocketAddress.class, DatagramSessionConfig.class, IoBuffer.class);
> Where 4th parameter is true, marking fragmentation is true for UDP.
> Or the METADATA parameter can be exposed to developer.
> This is link to the mailing list discussion.
> http://apache-mina.10907.n7.nabble.com/CumulativeProtocolDecoder-and-UDP-td18927.html



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message