Trustin Lee wrote:
Hi Maarten,Hi Trustin, 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); } } Everything seemed to work just fine, for every connection two sessionOpened events are fired : one before and one after the handshake. 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(). The only solution I see, is setting and checking a second session attribute in sessionOpened. (that seems to work now :-) Do you see a better solution based on mina-0.8.1 ? Do you see any other gaping holes in my approach ? Thanks in advance. Maarten |
- Re: [mina] running code after ssl handshake Maarten Bosteels
- Re: [mina] running code after ssl handshake Trustin Lee
