directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Trustin Lee <trus...@gmail.com>
Subject Re: [mina] running code after ssl handshake
Date Tue, 29 Nov 2005 01:04:16 GMT
Hi Maarten,

2005/11/29, Maarten Bosteels <m.bosteels@pandora.be>:
>
> Before I read your reply I had naively modified the 0.8.1 version of
> SSLHandler in a similar way:
> I added the following code:
>
>               initialHandshakeComplete = true;
> +            try   {
> +               session.setAttribute("SSL_HANDSHAKE_COMPLETE",
> Boolean,TRUE)
> +                nextFilter.sessionOpened(session);
> +              } catch (Exception e) {
> +                  log.error ("calling nextFilter.sessionOpened() failed",
> e);
> +              }
>               return;
>
> Thus I abuse the sessionOpened event for notification. And my event
> handler checks the session attribute to see if hanshake is complete.
>
>   public void sessionOpened(ProtocolSession session) throws Exception {
>     if (session.getAttribute("SSL_HANDSHAKE_COMPLETE") == null) {
>       doThis(session);
>     } else {
>       doThat(session);
>     }
>   }


It will work fine IMHO, but you'll have to do some work when you migrate to
1.0. :)

But when I create a lot of simultaneous connections, it sometimes happens
> that the session attribute is already set when the first sessionOpened event
>
> is checking it, resulting in two calls to doThis() and no call to
> doThat().


Hmm this might be a bug.  Another person reported this issue today.  I'll
try to figure it out.

Do you see a better solution based on mina-0.8.1 ?
> Do you see any other gaping holes in my approach ?


I think it is not a bad solution.  It will work, and there'll be no gapping
holes. :)

Trustin
--
what we call human nature is actually human habit
--
http://gleamynode.net/

Mime
View raw message