parameters: (self, all_ok, message)
docstring: Callback function for switching state and waking up main thread.
  
          This function is the only function witch can be called asynchronous.
  
          The ready can switch Connection to three states:
              WAIT_LEN if request was oneway.
              SEND_ANSWER if request was processed in normal way.
              CLOSED if request throws unexpected exception.
  
          The one wakes up main thread.
docstring_summary: Callback function for switching state and waking up main thread.
docstring_tokens: Callback function for switching state and waking up main thread .
function: def ready(self, all_ok, message):
          """Callback function for switching state and waking up main thread.
  
          This function is the only function witch can be called asynchronous.
  
          The ready can switch Connection to three states:
              WAIT_LEN if request was oneway.
              SEND_ANSWER if request was processed in normal way.
              CLOSED if request throws unexpected exception.
  
          The one wakes up main thread.
          """
          assert self.status == WAIT_PROCESS
          if not all_ok:
              self.close()
              self.wake_up()
              return
          self.len = 0
          if len(message) == 0:
              # it was a oneway request, do not write answer
              self._wbuf = b''
              self.status = WAIT_LEN
          else:
              self._wbuf = struct.pack('!i', len(message)) + message
              self.status = SEND_ANSWER
          self.wake_up()
function_tokens: def ready ( self , all_ok , message ) : assert self . status == WAIT_PROCESS if not all_ok : self . close ( ) self . wake_up ( ) return self . len = 0 if len ( message ) == 0 : # it was a oneway request, do not write answer self . _wbuf = b'' self . status = WAIT_LEN else : self . _wbuf = struct . pack ( '!i' , len ( message ) ) + message self . status = SEND_ANSWER self . wake_up ( )