MCPcopy Create free account
hub / github.com/catboost/catboost / process_command_message

Method process_command_message

contrib/libs/zeromq/src/zmtp_engine.cpp:533–563  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

531}
532
533int zmq::zmtp_engine_t::process_command_message (msg_t *msg_)
534{
535 const uint8_t cmd_name_size =
536 *(static_cast<const uint8_t *> (msg_->data ()));
537 const size_t ping_name_size = msg_t::ping_cmd_name_size - 1;
538 const size_t sub_name_size = msg_t::sub_cmd_name_size - 1;
539 const size_t cancel_name_size = msg_t::cancel_cmd_name_size - 1;
540 // Malformed command
541 if (unlikely (msg_->size () < cmd_name_size + sizeof (cmd_name_size)))
542 return -1;
543
544 const uint8_t *const cmd_name =
545 static_cast<const uint8_t *> (msg_->data ()) + 1;
546 if (cmd_name_size == ping_name_size
547 && memcmp (cmd_name, "PING", cmd_name_size) == 0)
548 msg_->set_flags (zmq::msg_t::ping);
549 if (cmd_name_size == ping_name_size
550 && memcmp (cmd_name, "PONG", cmd_name_size) == 0)
551 msg_->set_flags (zmq::msg_t::pong);
552 if (cmd_name_size == sub_name_size
553 && memcmp (cmd_name, "SUBSCRIBE", cmd_name_size) == 0)
554 msg_->set_flags (zmq::msg_t::subscribe);
555 if (cmd_name_size == cancel_name_size
556 && memcmp (cmd_name, "CANCEL", cmd_name_size) == 0)
557 msg_->set_flags (zmq::msg_t::cancel);
558
559 if (msg_->is_ping () || msg_->is_pong ())
560 return process_heartbeat_message (msg_);
561
562 return 0;
563}

Callers

nothing calls this directly

Calls 6

memcmpFunction · 0.85
set_flagsMethod · 0.80
is_pingMethod · 0.80
is_pongMethod · 0.80
dataMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected