def do_invoke()

in qpid/session.py [0:0]


  def do_invoke(self, op, args, kwargs):
    if self._closing:
      raise SessionClosed()

    ch = self.channel
    if ch == None:
      raise SessionDetached()

    if op == MessageTransfer:
      if len(args) == len(op.FIELDS) + 1:
        message = args[-1]
        args = args[:-1]
      else:
        message = kwargs.pop("message", None)
      if message is not None:
        kwargs["headers"] = message.headers
        kwargs["payload"] = message.body

    cmd = op(*args, **kwargs)
    cmd.sync = self.auto_sync or cmd.sync
    self.need_sync = not cmd.sync
    cmd.channel = ch.id

    if op.RESULT:
      result = Future(exception=SessionException)
      self.results[self.sender.next_id] = result

    self.send(cmd)

    log.debug("SENT %s", cmd)
    if op == MessageTransfer:
      msg.debug("SENT %s", cmd)

    if op.RESULT:
      if self.auto_sync:
        return result.get(self.timeout)
      else:
        return result
    elif self.auto_sync:
      self.sync(self.timeout)