mina-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Trustin Lee (JIRA)" <j...@apache.org>
Subject [jira] Resolved: (DIRMINA-208) Allow datagrams to be directed to a specific destination on a per-datagram instead of a per-session basis.
Date Tue, 11 Jul 2006 08:44:30 GMT
     [ http://issues.apache.org/jira/browse/DIRMINA-208?page=all ]
     
Trustin Lee resolved DIRMINA-208:
---------------------------------

    Resolution: Fixed

Thank you for your patch.  I've just checked in your fix.

> Allow datagrams to be directed to a specific destination on a per-datagram instead of
a per-session basis.
> ----------------------------------------------------------------------------------------------------------
>
>          Key: DIRMINA-208
>          URL: http://issues.apache.org/jira/browse/DIRMINA-208
>      Project: Directory MINA
>         Type: Wish

>     Versions: 0.9.3
>     Reporter: Jörg Henne
>     Assignee: Trustin Lee
>      Fix For: 0.9.5
>  Attachments: pcf.patch
>
> [this is a copy of a message I sent to the mailing-list a few days ago]
> A few weeks ago I started to work on the DS DHCP server. Work has progressed so far that
clients can successfully register IP addresses with the server and all, although the code
is still unfit for general consumption.
> Ir order to implement the DHCP functionality, however, it was necessary to apply a minor
patch to the MINA code base. The patch is necessitated by the fact that packets which are
received via broadcast from a DHCP client don't have a proper source address. As a consequence,
the reply messages must also be broadcast (or, in some cases sent by unicast to a different
address). The existing code created a new MINA IoSession per message in order to handle this
case, causing quite a lot of overhead and, worse, a new thread which lingered even after it
was done.
> In order to do away with the overhead, I introduced a special session attribute which
allows me to re-direct a message while it is sent like this:
>            InetSocketAddress isa = determineMessageDestination( request, reply );
>            session.setAttribute( "destination", isa );
>            session.write( reply );
> This property is used in DatagramAcceptorDelegate.flush(DatagramSessionImpl) to override
the message destination address like this:
> ...
>            if ( !key.isValid() )
>            {
>                continue;
>            }
>            // HACK: allow destination to be overridden using session attribute.
>            SocketAddress destination = session.getRemoteAddress();
>            Object d = session.getAttribute( "destination" );
>            if ( null != d && d instanceof SocketAddress )
>                destination = ( SocketAddress ) d;
>            int writtenBytes = ch.send( buf.buf(), destination );
> ...
> I am not too happy with this hack, but it was easy and worked. I you could come up with
a more general and elegant solution, I'd be more than happy.
> Joerg Henne

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


Mime
View raw message