enum {
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 */
};
const char *ceph_watch_event_name(int o);
reply->set_data(bl);
if (timed_out)
reply->return_code = -ETIMEDOUT;
- osd->send_message_osd_client(reply, client.get());
+ client->send_message(reply);
unregister_cb();
+
+ for (set<WatchRef>::iterator p = watchers.begin(); p != watchers.end(); ++p) {
+ (*p)->send_failed_notify(this);
+ }
complete = true;
}
}
cookie, notif->version, notif->notify_id,
CEPH_WATCH_EVENT_NOTIFY, notif->payload);
notify_msg->notifier_gid = notif->client_gid;
- osd->send_message_osd_client(notify_msg, conn.get());
+ conn->send_message(notify_msg);
+}
+
+void Watch::send_failed_notify(Notify *notif)
+{
+ bufferlist empty;
+ MWatchNotify *reply(new MWatchNotify(cookie, notif->version, notif->notify_id,
+ CEPH_WATCH_EVENT_FAILED_NOTIFY, empty));
+ reply->notifier_gid = notif->client_gid;
+ conn->send_message(reply);
}
void Watch::notify_ack(uint64_t notify_id, bufferlist& reply_bl)
/// Unregisters the timeout callback
void unregister_cb();
+ /// send a failed notify message
+ void send_failed_notify(Notify *notif);
+
/// NOTE: must be called with pg lock held
~Watch();