--- Julien Vermillard <[EMAIL PROTECTED]> wrote:

> Hi,
> 
> After talking with Peter I'm trying to add
> reconnection features to
> sockets. It's in the form of a reconnection() method
> in SocketConnector
> for recycling a closed IoSession. It's a bit tricky
> but look like
> working.
> 
> My last problem is why when the session is closed
> the filter chain is
> cleared ? Because it preventing me to keep the
> inited filterchain after
> a reconnection. 
> 
> Some solutions : 
>  - remove the "session.getFilterChain().clear();"
> when the session is
> closed

I would think this is more valid.

>  - recall IoHandler.sessionCreated(...) when a
> session is reconnected.
> normaly it will recreate the filterchain because 
> it's where everybody
> puut the filter creation code.

This is not necessarily true.  It may be common
practice (and probably a bad one) but it is by no
means required.  I plan on using the various config
API's to setup everything outside the IoHandler.

In my opinion (and I could be wrong, but it is my
opinion) everything should be setup and ready to go
before a client ever connects to the server.  The only
time you should modify the filter chain is if your
implementing something like startTLS or similar.

> 
> The last solution can be confusing because a session
> can be created
> multiple time..

Yes, I would think it is confusing, and possibly wrong
simply if you think about when reconnect is called. 
Reconnect is called when the client/server wishes to
reestablish a connection to the remote end.  Your
probably doing this because you were in the middle of
something and lost the connection.  If your not
creating an entirely new Iosession object then your
not really initiating a new session, your
re-establishing communication.  Thus, sessionCreated
probably shouldn't be called.

Just my opinion.
Rob

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

Reply via email to