Skip to content
Snippets Groups Projects
Commit 3c12f7e1 authored by Daniel Salzman's avatar Daniel Salzman
Browse files

Merge branch 'fix-lost-notify' into 'master'

fix: lost notify message during zone transfer

closes #344

See merge request !385
parents af5660b0 32039961
No related branches found
No related tags found
No related merge requests found
......@@ -279,8 +279,11 @@ void zone_events_schedule_at(zone_t *zone, zone_event_type_t type, time_t time)
zone_events_t *events = &zone->events;
pthread_mutex_lock(&events->mx);
event_set_time(events, type, time);
reschedule(events);
time_t current = event_get_time(events, type);
if (time == 0 || current == 0 || time < current) {
event_set_time(events, type, time);
reschedule(events);
}
pthread_mutex_unlock(&events->mx);
}
......
......@@ -104,6 +104,10 @@ void zone_events_enqueue(struct zone *zone, zone_event_type_t type);
/*!
* \brief Schedule new zone event to absolute time.
*
* If the event is already scheduled, the new time will be set only if the
* new time is earlier than the currently scheduled one. An exception is
* a zero time, which causes event cancellation.
*
* \param zone Zone to schedule new event for.
* \param type Type of event.
* \param time Absolute time.
......@@ -113,6 +117,8 @@ void zone_events_schedule_at(struct zone *zone, zone_event_type_t type, time_t t
/*!
* \brief Schedule new zone event using relative time to current time.
*
* The function internally uses \ref zone_events_schedule_at.
*
* \param zone Zone to schedule new event for.
* \param type Type of event.
* \param dt Relative time.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment