diff -r 976d7fe6cf25 -r 84fba41b2f6f RefactoringRope/JsonClient.py --- a/RefactoringRope/JsonClient.py Sun Feb 03 15:28:02 2019 +0100 +++ b/RefactoringRope/JsonClient.py Fri Feb 22 19:11:22 2019 +0100 @@ -37,7 +37,6 @@ order to identify the connection @type str """ - self.__exitClient = False self.__connection = socket.create_connection((host, port)) if idString: reply = idString + '\n' @@ -123,31 +122,26 @@ """ try: selectErrors = 0 - while True: + while selectErrors <= 10: # selected arbitrarily try: rrdy, wrdy, xrdy = select.select( [self.__connection], [], []) + + # Just waiting for self.__connection. Therefor no check + # needed. + method, params = self.__receiveJson() + if method is None: + selectErrors += 1 + elif method == "Exit": + break + else: + self.handleCall(method, params) + + # reset select errors + selectErrors = 0 + except (select.error, KeyboardInterrupt, socket.error): selectErrors += 1 - if selectErrors <= 10: # selected arbitrarily - # just carry on - continue - else: - break - - # reset select errors - selectErrors = 0 - - if self.__connection in rrdy: - method, params = self.__receiveJson() - if method is not None: - if method == "Exit": - self.__exitClient = True - else: - self.handleCall(method, params) - - if self.__exitClient: - break except Exception: exctype, excval, exctb = sys.exc_info()