Invoked by pika when RabbitMQ has finished the Exchange.Declare RPC
        command.

        :param pika.Frame.Method unused_frame: Exchange.DeclareOk response frame
772564
def on_exchange_declareok(self, unused_frame):
        
        self._logger.debug('Exchange declared')
        self.setup_queue(self._queue)
1212860
function RpcNotification(method, params)
{
  if(defineProperty_IE8)
  {
    this.method = method
    this.params = params
  }
  else
  {
    Object.defineProperty(this, 'method', {value: method, enumerable: true});
    Object.defineProperty(this, 'params', {value: params, enumerable: true});
  }
}
447827
def on_sigabrt(self, signal_unused, frame_unused):
        
        LOGGER.info('Stopping HTTP Server and IOLoop')
        self.http_server.stop()
        self.ioloop.stop()
877765
function unused(src) {
    var ast = esprima.parse(src, {
        loc: true
    });

    // map of identifiers -> location
    // when an identifier is seen, it is removed from the map
    var unused_vars = [];

    function exec(node, context) {
        if (!node) {
            return;
        }

        handlers[node.type](node, context);
    };

    function maybe_set_id(id, context, is_param) {
        if (!id) {
            return;
        }

        if (id.type !== 'Identifier') {
            exec(id, context);
            return;
        }

        context.set(id.name, {
            name: id.name,
            loc: id.loc.start,
            param: is_param || false
        });
    }

    function maybe_set_param(id, context) {
        maybe_set_id(id, context, true);
    }

    var handlers = {
        VariableDeclaration: function(node, context) {
            node.declarations.forEach(function(node) {
                exec(node, context)
            });
        },
        VariableDeclarator: function(node, context) {
            maybe_set_id(node.id, context);
            exec(node.init, context);
        },
        FunctionExpression: function(node, context) {
            // function express ids are ignored
            // assume user specified it for backtrace reasons

            var ctx = new Context(context);

            // parameters are within the context of the function
            node.params.forEach(function(node) {
                maybe_set_param(node, ctx);
            });

            // exec function body with new context
            exec(node.body, ctx);

            Array.prototype.push.apply(unused_vars, ctx.unused());
        },
        FunctionDeclaration: function(node, context) {
            maybe_set_id(node.id, context);

            var ctx = new Context(context);

            // parameters are within the context of the function
            node.params.forEach(function(node) {
                maybe_set_param(node, ctx);
            });

            // exec function body with new context
            exec(node.body, ctx);

            Array.prototype.push.apply(unused_vars, ctx.unused());
        },
        BlockStatement: function(node, context) {
            node.body.forEach(function(node) {
                exec(node, context);
            });
        },
        CallExpression: function(node, context) {
            exec(node.callee, context);

            node.arguments.forEach(function(node) {
                exec(node, context);
            });
        },
        MemberExpression: function(node, context) {
            exec(node.object, context);
            exec(node.property, context);
        },
        ExpressionStatement: function(node, context) {
            exec(node.expression, context);
        },
        ObjectExpression: function(node, context) {
            node.properties.forEach(function(node) {
                exec(node, context);
            });
        },
        AssignmentExpression: function(node, context) {
            exec(node.left, context);
            exec(node.right, context);
        },
        LogicalExpression: function(node, context) {
            exec(node.left, context);
            exec(node.right, context);
        },
        BinaryExpression: function(node, context) {
            exec(node.left, context);
            exec(node.right, context);
        },
        TryStatement: function(node, context) {
            node.block.body.forEach(function(node) {
                exec(node, context);
            });

            node.handlers.forEach(function(node) {
                exec(node, context);
            });
        },
        CatchClause: function(node, context) {
            exec(node.param, context);
            exec(node.body, context);
        },
        ConditionalExpression: function(node, context) {
            exec(node.test, context);
            exec(node.consequent, context);
            exec(node.alternate, context);
        },
        ArrayExpression: function(node, context) {
            node.elements.forEach(function(node) {
                exec(node, context);
            });
        },
        UpdateExpression: function(node, context) {
            exec(node.argument, context);
        },
        UnaryExpression: function(node, context) {
            exec(node.argument, context);
        },
        ThrowStatement: function(node, context) {
            exec(node.argument, context);
        },
        IfStatement: function(node, context) {
            exec(node.test, context);
            exec(node.consequent, context);
            exec(node.alternate, context);
        },
        ReturnStatement: function(node, context) {
            exec(node.argument, context);
        },
        SwitchStatement: function(node, context) {
            exec(node.discriminant, context);
            node.cases.forEach(function(node) {
                exec(node, context);
            });
        },
        SwitchCase: function(node, context) {
            exec(node.test, context);
            node.consequent.forEach(function(node) {
                exec(node, context);
            });
        },
        NewExpression: function(node, context) {
            exec(node.callee, context);
            node.arguments.forEach(function(node) {
                exec(node, context);
            });
        },
        Property: function(node, context) {
            exec(node.key, context);
            exec(node.value, context);
        },
        ForInStatement: function(node, context) {
            exec(node.left, context);
            exec(node.right, context);
            exec(node.body, context);
        },
        WhileStatement: function(node, context) {
            exec(node.test, context);
            exec(node.body, context);
        },
        SequenceExpression: function(node, context) {
            node.expressions.forEach(function(node) {
                exec(node, context);
            });
        },
        ForStatement: function(node, context) {
            exec(node.init, context);
            exec(node.test, context);
            exec(node.update, context);
            exec(node.body, context);
        },
        DoWhileStatement: function(node, context) {
            exec(node.body, context);
            exec(node.test, context);
        },
        ContinueStatement: function() {
        },
        BreakStatement: function() {
        },
        ThisExpression: function() {
        },
        EmptyStatement: function() {
        },
        Literal: function() {
        },
        Identifier: function(node, context) {
            context.remove(node.name);
        },
    };

    // TODO handle the case where use of a variable comes before declaring it
    // while this seems retarded, javascript does allow it

    var body = ast.body;

    var ctx = new Context();

    body.forEach(function(node) {
        exec(node, ctx);
    });

    Array.prototype.push.apply(unused_vars, ctx.unused());

    return unused_vars;
}
1079913
def dispatch(self, frame):
        '''
        
        '''
        if frame.type() == HeartbeatFrame.type():
            self.send_heartbeat()

        elif frame.type() == MethodFrame.type():
            if frame.class_id == 10:
                cb = self._method_map.get(frame.method_id)
                if cb:
                    method = self.clear_synchronous_cb(cb)
                    method(frame)
                else:
                    raise Channel.InvalidMethod(
                        "unsupported method %d on channel %d",
                        frame.method_id, self.channel_id)
            else:
                raise Channel.InvalidClass(
                    "class %d is not supported on channel %d",
                    frame.class_id, self.channel_id)

        else:
            raise Frame.InvalidFrameType(
                "frame type %d is not supported on channel %d",
                frame.type(), self.channel_id)
784136
def call(self, method, params):
        
        msgid = self._endpoint.send_request(method, params)
        while True:
            if not self._endpoint.receive_messages():
                raise EOFError("EOF")
            res = self._endpoint.get_response(msgid)
            if res:
                result, error = res
                if error is None:
                    return result
                raise RPCError(error)
            self._process_input_notification()
            self._process_input_request()
1225031
def process_frame(self, frame):
        
        cmd_method = frame.cmd.lower()

        if not cmd_method in VALID_COMMANDS:
            raise ProtocolError("Invalid STOMP command: {}".format(frame.cmd))

        method = getattr(self, cmd_method, None)

        if not self.engine.connected and method not in (self.connect, self.stomp):
            raise ProtocolError("Not connected.")

        try:
            transaction = frame.headers.get('transaction')
            if not transaction or method in (self.begin, self.commit, self.abort):
                method(frame)
            else:
                if not transaction in self.engine.transactions:
                    raise ProtocolError(
                        "Invalid transaction specified: %s" % transaction)
                self.engine.transactions[transaction].append(frame)
        except Exception as e:
            self.engine.log.error("Error processing STOMP frame: %s" % e)
            self.engine.log.exception(e)
            try:
                self.engine.connection.send_frame(ErrorFrame(str(e), str(e)))
            except Exception as e:  # pragma: no cover
                self.engine.log.error("Could not send error frame: %s" % e)
                self.engine.log.exception(e)
        else:
            # The protocol is not especially clear here (not sure why I'm surprised)
            # about the expected behavior WRT receipts and errors.  We will assume that
            # the RECEIPT frame should not be sent if there is an error frame.
            # Also we'll assume that a transaction should not preclude sending the receipt
            # frame.
            # import pdb; pdb.set_trace()
            if frame.headers.get('receipt') and method != self.connect:
                self.engine.connection.send_frame(ReceiptFrame(
                    receipt=frame.headers.get('receipt')))
47721
def handle_control_frame(self, frame):
        
        if frame.opcode == OPCODE_CLOSE:
            self.close_frame_received = True
            code, reason = frame.unpack_close()

            if self.close_frame_sent:
                self.onclose(code, reason)
                self.sock.close()
                raise SocketClosed(True)
            else:
                self.close_params = (code, reason)
                self.send_close_frame(code, reason)

        elif frame.opcode == OPCODE_PING:
            # Respond with a pong message with identical payload
            self.send_frame(ControlFrame(OPCODE_PONG, frame.payload))

        elif frame.opcode == OPCODE_PONG:
            # Assert that the PONG payload is identical to that of the PING
            if not self.ping_sent:
                raise PingError('received PONG while no PING was sent')

            self.ping_sent = False

            if frame.payload != self.ping_payload:
                raise PingError('received PONG with invalid payload')

            self.ping_payload = None
            self.onpong(frame.payload)
1252236
def _process_method_frame(self, channel, payload):
        
        method_sig = unpack('>HH', payload[:4])
        args = AMQPReader(payload[4:])

        if method_sig in _CONTENT_METHODS:
            #
            # Save what we've got so far and wait for the content-header
            #
            self.partial_messages[channel] = _PartialMessage(method_sig, args)
            self.expected_types[channel] = 2
        else:
            self.queue.put((channel, method_sig, args, None))
1281189
def idle(&response_handler)
      raise LocalJumpError, "no block given" unless response_handler

      response = nil

      synchronize do
        tag = Thread.current[:net_imap_tag] = generate_tag
        put_string("#{tag} IDLE#{CRLF}")

        begin
          add_response_handler(response_handler)
          @idle_done_cond = new_cond
          @idle_done_cond.wait
          @idle_done_cond = nil
          if @receiver_thread_terminating
            raise Net::IMAP::Error, "connection closed"
          end
        ensure
          unless @receiver_thread_terminating
            remove_response_handler(response_handler)
            put_string("DONE#{CRLF}")
            response = get_tagged_response(tag, "IDLE")
          end
        end
      end

      return response
    end
65450
def on_consumer_cancelled(self, method_frame):
        
        msg = 'Consumer was cancelled remotely, shutting down: {0!r}'
        logger.info(msg.format(method_frame))
        if self._channel:
            self._channel.close()
287977
def method_missing(method, *args, &block)
      return rpc(method, args.first, args[1]) if function(method)

      super
    end
940495
function frame(frameTime) {
		// Steal the current execution queue, and switch it with
		// a new one so that calls from handlers will be queued.
		var handlers = nextBatch; nextBatch = {};
		// Calculate time since last frame.
		var elapsed = frameTime - lastFrameTime;
		// We are taking care of this frame, so allow another
		// frame to be requested from inside the handlers.
		pendingFrame = false;
		// Replay each call with its own context and arguments.
		for (var k in handlers) {
			handlers[k](elapsed);
		}
		// Keep track of updated frame time.
		lastFrameTime = frameTime;
	}
918673
def _send_and_wait(self, **kwargs):
        
        frame_id = self.next_frame_id
        kwargs.update(dict(frame_id=frame_id))
        self._send(**kwargs)
        timeout = datetime.now() + const.RX_TIMEOUT
        while datetime.now() < timeout:
            try:
                frame = self._rx_frames.pop(frame_id)
                raise_if_error(frame)
                return frame
            except KeyError:
                sleep(0.1)
                continue
        _LOGGER.exception(
            "Did not receive response within configured timeout period.")
        raise exceptions.ZigBeeResponseTimeout()
576251
def connect(request, _unused_call)
      logger.debug("RPC Connect: #{request.inspect}")

      socket = build_socket(env: rack_env(request))

      connection = factory.call(socket)

      connection.handle_open

      if socket.closed?
        AnyCable::ConnectionResponse.new(status: AnyCable::Status::FAILURE)
      else
        AnyCable::ConnectionResponse.new(
          status: AnyCable::Status::SUCCESS,
          identifiers: connection.identifiers_json,
          transmissions: socket.transmissions
        )
      end
    rescue StandardError => exp
      notify_exception(exp, :connect, request)

      AnyCable::ConnectionResponse.new(
        status: AnyCable::Status::ERROR,
        error_msg: exp.message
      )
    end
827013
def on_call(receiver, dot, method)
      if rcv = resolve_receiver(receiver)
        method_call(method, [rcv])
      end
       
      keep_walking(receiver)
    end
117916
def rpc_request(self, frame_out, connection_adapter=None):
        
        with self.rpc.lock:
            uuid = self.rpc.register_request(frame_out.valid_responses)
            self._connection.write_frame(self.channel_id, frame_out)
            return self.rpc.get_request(
                uuid, connection_adapter=connection_adapter
            )