def run_rx(self):
        prev_reconnect_count = -1
        while True:
            if self.__owner._shutdown:
                return
            if self.__reconnect:
                time.sleep(0.1)
                continue
            try:
                # between the check and write to prev_reconnect_count the self.__reconnect_count may change
                curr_reconnect_count = self.__reconnect_count
                if curr_reconnect_count != prev_reconnect_count:
                    prev_reconnect_count = curr_reconnect_count
                    pollobj = poll()
                    pollobj.register(self.fileno(), POLLIN)
                pollret = dict(pollobj.poll())
                if pollret.get(self.fileno(), 0) & POLLIN == 0:
                    continue
                self.recv()
            except:
                print datetime.datetime.now(), 'XMPP_server: unhandled exception when receiving incoming data'
                print '-' * 70
                traceback.print_exc(file = sys.stdout)
                print '-' * 70
                sys.stdout.flush()
                self.__reconnect = True
                self.__owner._wi_available.acquire()
                self.__owner._wi_available.notifyAll()
                self.__owner._wi_available.release()
                time.sleep(0.1)
dataset/ETHPy150Open sippy/b2bua/sippy/XMPP_server.py/Worker.run_rx/original