Пример #1
0
 def process(self):
     if not self.connected:
         return False
     while True:
         try:
             with nonBlocking(self.processingLock):
                 if len(self.read_buf) < self.expectBytes:
                     return False
                 if getattr(self, "state_" + str(self.state))() is False:
                     break
         except AttributeError:
             raise
         except BusyError:
             return False
     return False
Пример #2
0
 def process(self):
     while self.connected and not state.shutdown:
         try:
             with nonBlocking(self.processingLock):
                 if not self.connected or state.shutdown:
                     break
                 if len(self.read_buf) < self.expectBytes:
                     return False
                 if not getattr(self, "state_" + str(self.state))():
                     break
         except AttributeError:
             logger.error("Unknown state %s", self.state)
             raise
         except BusyError:
             return False
     return False
Пример #3
0
 def process(self):
     while self.connected and not state.shutdown:
         try:
             with nonBlocking(self.processingLock):
                 if not self.connected or state.shutdown:
                     break
                 if len(self.read_buf) < self.expectBytes:
                     return False
                 if not getattr(self, "state_" + str(self.state))():
                     break
         except AttributeError:
             logger.error("Unknown state %s", self.state, exc_info=True)
             raise
         except BusyError:
             return False
     return False
 def process(self):
     """Process (parse) data that's in the buffer, as long as there is enough data and the connection is open."""
     while self.connected and not state.shutdown:
         try:
             with nonBlocking(self.processingLock):
                 if not self.connected or state.shutdown:
                     break
                 if len(self.read_buf) < self.expectBytes:
                     return False
                 try:
                     cmd = getattr(self, "state_" + str(self.state))
                 except AttributeError:
                     logger.error("Unknown state %s",
                                  self.state,
                                  exc_info=True)
                     raise UnknownStateError(self.state)
                 if not cmd():
                     break
         except BusyError:
             return False
     return False