You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by Trustin Lee <tr...@gmail.com> on 2007/02/02 15:02:37 UTC

Re: remoteAddress is null in sessionClosed

On 2/1/07, Maarten Bosteels <mb...@gmail.com> wrote:
>
> Hello all,
>
> My IoHandler.sessionClosed() logs the remote IP address.
> It works perfectly with mina 0.8.1 but throws a NPE in 2.0
>
> I can work around it by storing the SocketAddress in the IoSession as an
> attribute.
>
> But I was wondering if there are plans to change this behaviour,
> or maybe add an beforeSessionClosed() callback to IoHandler ?
>
> At least, I think it should be mentioned in the javadoc.
>
> public void sessionClosed(IoSession session) throws Exception {
>     InetSocketAddress address = (InetSocketAddress)
> session.getRemoteAddress
> ();
>     logger.info("address=" + address.getAddress().getHostAddress());
>    ...
> }


It's a bug, so it should be fixed. :)

Thanks,
Trustin
-- 
what we call human nature is actually human habit
--
http://gleamynode.net/
--
PGP key fingerprints:
* E167 E6AF E73A CBCE EE41  4A29 544D DE48 FE95 4E7E
* B693 628E 6047 4F8F CFA4  455E 1C62 A7DC 0255 ECA6