def receive_message(self, wait_till): """receive_message(self, wait_till) -> message_type, packet Read a message off the stream. <wait_till>: List of message types that you are looking for. """ if not self._receive_thread: raise SSH_Protocol_Error, 'receive thread not running' self.tmc.add(coro.current(), wait_till) try: return coro._yield() except: self.tmc.remove(coro.current()) raise
def receive_message(self, wait_till): """receive_message(self, wait_till) -> message_type, packet Read a message off the stream. <wait_till>: List of message types that you are looking for. """ if not self._receive_thread: raise SSH_Protocol_Error('receive thread not running') self.tmc.add(coro.current(), wait_till) try: return coro._yield() except: self.tmc.remove(coro.current()) raise
def call (self, properties, payload, exchange, routing_key): """Make an RPC call. *properties*: a properties dictionary (e.g. {'content-type':'application/json', ...}) *payload*: the data/argument to the rpc function. *exchange*, *routing_key*: as with basic_publish. """ correlation_id = str (self.uuid_fun()) properties['correlation-id'] = correlation_id properties['reply-to'] = self.queue # W ('sending call to rpc server (uuid=%r)\n' % (correlation_id,)) self.channel.basic_publish (payload, exchange, routing_key, properties=properties) self.pending[correlation_id] = coro.current() # W ('waiting for reply\n') return coro._yield()
def foo(): self.assertFalse(exception_raised[0]) try: coro._yield() except TestException: exception_raised[0] = True
def get_next_request (self): return coro._yield()