Commit 9db6b8ff authored by Antoine Millet's avatar Antoine Millet
Browse files

Now try to disconnect an already connected cli while new client connection.

parent 71cc6ad2
Loading
Loading
Loading
Loading
+13 −3
Original line number Diff line number Diff line
@@ -891,9 +891,19 @@ class WelcomeHandler(CCHandler):
                role = 'host'
                create_object = True

            # Try to register the client:
            for _ in xrange(5):
                try:
                    self._server.register(login, role, conn, create_object)
                except AlreadyRegistered:
                    if role == 'cli':
                        try:
                            self._server.kill(login)
                        except NotConnectedAccountError:
                            pass
                else:
                    break
            else:
                logging.warning(logmsg + 'already connected (%s)',
                                conn.getpeername(), login)
                raise AuthenticationError('Already connected')