case CEPH_WATCH_EVENT_NOTIFY: return "notify";
case CEPH_WATCH_EVENT_NOTIFY_COMPLETE: return "notify_complete";
case CEPH_WATCH_EVENT_FAILED_NOTIFY: return "failed_notify";
+ case CEPH_WATCH_EVENT_DISCONNECT: return "disconnect";
}
return "???";
}
CEPH_WATCH_EVENT_NOTIFY = 1, /* notifying watcher */
CEPH_WATCH_EVENT_NOTIFY_COMPLETE = 2, /* notifier notified when done */
CEPH_WATCH_EVENT_FAILED_NOTIFY = 3, /* we made a notify time out */
+ CEPH_WATCH_EVENT_DISCONNECT = 4, /* we were disconnected */
};
const char *ceph_watch_event_name(int o);
return;
}
+ watch->send_disconnect();
+
obc->watchers.erase(make_pair(watch->get_cookie(), watch->get_entity()));
obc->obs.oi.watchers.erase(make_pair(watch->get_cookie(), watch->get_entity()));
watch->remove();
conn->send_message(reply);
}
+void Watch::send_disconnect()
+{
+ if (!conn)
+ return;
+ bufferlist empty;
+ MWatchNotify *reply(new MWatchNotify(cookie, 0, 0,
+ CEPH_WATCH_EVENT_DISCONNECT, empty));
+ conn->send_message(reply);
+}
+
void Watch::notify_ack(uint64_t notify_id, bufferlist& reply_bl)
{
dout(10) << "notify_ack" << dendl;
/// send a failed notify message
void send_failed_notify(Notify *notif);
+ /// send a disconnect notice to the client
+ void send_disconnect();
+
/// NOTE: must be called with pg lock held
~Watch();