{
assert(m != NULL);
+ /* deal with all messages that do not necessarily need caps */
+ bool dealt_with = true;
switch (m->get_type()) {
-
- case MSG_ROUTE:
- handle_route(static_cast<MRoute*>(m));
- break;
-
- // misc
- case CEPH_MSG_MON_GET_MAP:
- handle_mon_get_map(static_cast<MMonGetMap*>(m));
- break;
-
- case CEPH_MSG_MON_GET_VERSION:
- handle_get_version(static_cast<MMonGetVersion*>(m));
- break;
-
- case MSG_MON_COMMAND:
- handle_command(static_cast<MMonCommand*>(m));
+ // auth
+ case MSG_MON_GLOBAL_ID:
+ case CEPH_MSG_AUTH:
+ /* no need to check caps here */
+ paxos_service[PAXOS_AUTH]->dispatch((PaxosServiceMessage*)m);
break;
- case CEPH_MSG_MON_SUBSCRIBE:
- /* FIXME: check what's being subscribed, filter accordingly */
- handle_subscribe(static_cast<MMonSubscribe*>(m));
+ case CEPH_MSG_PING:
+ handle_ping(static_cast<MPing*>(m));
break;
- case MSG_MON_PROBE:
- handle_probe(static_cast<MMonProbe*>(m));
+ default:
+ dealt_with = false;
break;
+ }
+ if (dealt_with)
+ return;
- // Sync (i.e., the new slurp, but on steroids)
- case MSG_MON_SYNC:
- handle_sync(static_cast<MMonSync*>(m));
- break;
- case MSG_MON_SCRUB:
- handle_scrub(static_cast<MMonScrub*>(m));
- break;
+ /* deal with all messages which caps should be checked somewhere else */
+ dealt_with = true;
+ switch (m->get_type()) {
// OSDs
case MSG_OSD_MARK_ME_DOWN:
paxos_service[PAXOS_MDSMAP]->dispatch((PaxosServiceMessage*)m);
break;
- // auth
- case MSG_MON_GLOBAL_ID:
- case CEPH_MSG_AUTH:
- /* no need to check caps here */
- paxos_service[PAXOS_AUTH]->dispatch((PaxosServiceMessage*)m);
- break;
// pg
case CEPH_MSG_STATFS:
paxos_service[PAXOS_LOG]->dispatch((PaxosServiceMessage*)m);
break;
+ default:
+ dealt_with = false;
+ break;
+ }
+ if (dealt_with)
+ return;
+
+ /* messages we, the Monitor class, need to deal with
+ * but may be sent by clients. */
+ dealt_with = true;
+ switch (m->get_type()) {
+
+ // misc
+ case CEPH_MSG_MON_GET_MAP:
+ handle_mon_get_map(static_cast<MMonGetMap*>(m));
+ break;
+
+ case CEPH_MSG_MON_GET_VERSION:
+ handle_get_version(static_cast<MMonGetVersion*>(m));
+ break;
+
+ case MSG_MON_COMMAND:
+ handle_command(static_cast<MMonCommand*>(m));
+ break;
+
+ case CEPH_MSG_MON_SUBSCRIBE:
+ /* FIXME: check what's being subscribed, filter accordingly */
+ handle_subscribe(static_cast<MMonSubscribe*>(m));
+ break;
+
+ default:
+ dealt_with = false;
+ break;
+ }
+ if (dealt_with)
+ return;
+
+ /* messages that should only be sent by another monitor */
+ dealt_with = true;
+ switch (m->get_type()) {
+
+ case MSG_ROUTE:
+ handle_route(static_cast<MRoute*>(m));
+ break;
+
+ case MSG_MON_PROBE:
+ handle_probe(static_cast<MMonProbe*>(m));
+ break;
+
+ // Sync (i.e., the new slurp, but on steroids)
+ case MSG_MON_SYNC:
+ handle_sync(static_cast<MMonSync*>(m));
+ break;
+ case MSG_MON_SCRUB:
+ handle_scrub(static_cast<MMonScrub*>(m));
+ break;
+
+ /* log acks are sent from a monitor we sent the MLog to, and are
+ never sent by clients to us. */
case MSG_LOGACK:
log_client.handle_log_ack((MLogAck*)m);
m->put();
health_monitor->dispatch(static_cast<MMonHealth *>(m));
break;
- case CEPH_MSG_PING:
- handle_ping(static_cast<MPing*>(m));
- break;
-
default:
- dout(1) << "dropping unexpected " << *m << dendl;
- m->put();
+ dealt_with = false;
break;
}
+ if (!dealt_with) {
+ dout(1) << "dropping unexpected " << *m << dendl;
+ m->put();
+ }
}
void Monitor::handle_ping(MPing *m)