I think we can ensure that the two behaviours are consistent, i.e. either always put the session in the managed list before calling the listener. This should be an easy fix for Nio2 service. Would you mind raising a JIRA issue for that ?
2015-05-07 23:10 GMT+02:00 Pellerin, Clement <[email protected]>: > You are right, the problem is not related to the idle timeout. > > Calling session.getIoSession().getService().getManagedSessions() in the > sessionCreated() method of a SessionListener gives different results > depending on which IoService you are running. With Mina, the session that > triggered the event is already listed, so the first call returns 1 session. > With Nio2, the session is obviously created but it is not yet managed. The > first call returns 0 sessions. > > I believe this is a bug because you cannot reliably implement an algorithm > that depends on the number of managed sessions without special knowledge > about the active IoService. > > My goal is to implement a bound on the total number of sessions. > MAX_CONCURRENT_SESSIONS is per user, which is not sufficient. > I suspect I would have the same problem with the size of > getmanagedSessions() if I move the check directly in the SessionFactory as > you suggested earlier. > What is the best way to implement that bound on the global number of > sessions? > > -----Original Message----- > From: Guillaume Nodet [mailto:[email protected]] > Sent: Thursday, May 07, 2015 12:32 PM > To: [email protected] > Subject: Re: Idle SSHD sessions still managed > > This should work. > The idle timeout will close the ssh session which should in turn close the > ioSession, and that session should be removed from the list of managed > sessions. > However, this happens slightly asynchronously, as the idle timeout will > trigger the write of the disconnect message and the session will only be > closed after the message has been written. > > 2015-05-07 17:40 GMT+02:00 Pellerin, Clement <[email protected]>: > > > I am implementing an SshServer with SSHD 0.14.0 When a connection > > becomes idle, the client gets disconnected, but the connection remains > > managed. > > It still appears in > > session.getIoSession().getService().getManagedSessions() > > What am I doing wrong? > > > > >
