[asterisk-commits] twilson: branch twilson/calendaring r166902 - in /team/twilson/calendaring: i...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Dec 30 13:28:51 CST 2008
Author: twilson
Date: Tue Dec 30 13:28:51 2008
New Revision: 166902
URL: http://svn.digium.com/view/asterisk?view=rev&rev=166902
Log:
Address some of russell's concerns on reviewboard. Try to get the sched stuff worked out. Plenty more fixes to do.
Modified:
team/twilson/calendaring/include/asterisk/calendar.h
team/twilson/calendaring/main/calendar.c
team/twilson/calendaring/res/res_caldav.c
team/twilson/calendaring/res/res_exchangecal.c
team/twilson/calendaring/res/res_icalendar.c
Modified: team/twilson/calendaring/include/asterisk/calendar.h
URL: http://svn.digium.com/view/asterisk/team/twilson/calendaring/include/asterisk/calendar.h?view=diff&rev=166902&r1=166901&r2=166902
==============================================================================
--- team/twilson/calendaring/include/asterisk/calendar.h (original)
+++ team/twilson/calendaring/include/asterisk/calendar.h Tue Dec 30 13:28:51 2008
@@ -131,7 +131,8 @@
*
* \param tech calendar technology to register
*
- * \return Returns 0 on success, -1 on failure
+ * \retval 0 success
+ * \retval -1 failure
*/
int ast_calendar_register(const struct ast_calendar_tech *tech);
@@ -139,7 +140,8 @@
*
* \param tech calendar technology to unregister
*
- * \return Returns 0 on success, -1 on failure
+ * \retval 0 success
+ * \retva -1 failure
*/
void ast_calendar_unregister(const struct ast_calendar_tech *tech);
Modified: team/twilson/calendaring/main/calendar.c
URL: http://svn.digium.com/view/asterisk/team/twilson/calendaring/main/calendar.c?view=diff&rev=166902&r1=166901&r2=166902
==============================================================================
--- team/twilson/calendaring/main/calendar.c (original)
+++ team/twilson/calendaring/main/calendar.c Tue Dec 30 13:28:51 2008
@@ -21,6 +21,9 @@
*/
#include "asterisk.h"
+
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
+
#include "asterisk/_private.h"
#include "asterisk/calendar.h"
#include "asterisk/utils.h"
@@ -275,16 +278,28 @@
{
struct ast_calendar_event *event = obj;
- ao2_lock(event);
ast_debug(3, "Destroying event for calendar '%s'\n", event->owner->name);
-
- while (event->notify_sched > -1 && ast_sched_del(sched, event->notify_sched)) {
- ao2_unlock(event);
- usleep(1);
- ao2_lock(event);
- }
-
ast_string_field_free_memory(event);
+
+ return;
+}
+
+static int cb_true(void *user_data, void *arg, int flags)
+{
+ return CMP_MATCH;
+}
+
+static struct ast_calendar_event *destroy_event(struct ast_calendar_event *event)
+{
+ if (event->notify_sched > -1 && ast_sched_del(sched, event->notify_sched)) {
+ ast_debug(3, "Notification running, can't delete sched entry\n");
+ }
+ if (event->bs_start_sched > -1 && ast_sched_del(sched, event->bs_start_sched)) {
+ ast_debug(3, "Devicestate update (start) running, can't delete sched entry\n");
+ }
+ if (event->bs_end_sched > -1 && ast_sched_del(sched, event->bs_end_sched)) {
+ ast_debug(3, "Devicestate update (end) running, can't delete sched entry\n");
+ }
/* If an event is being deleted and we've fired an event changing the status at the beginning,
* but haven't hit the end event yet, go ahead and set the devicestate to the current busy status */
@@ -296,25 +311,15 @@
}
}
- while (event->bs_start_sched >= 0 && ast_sched_del(sched, event->bs_start_sched)) {
- ao2_unlock(event);
- usleep(1);
- ao2_lock(event);
- }
-
- while (event->bs_end_sched > -1 && ast_sched_del(sched, event->bs_end_sched)) {
- ao2_unlock(event);
- usleep(1);
- ao2_lock(event);
- }
-
- ao2_unlock(event);
-
- return;
-}
-
-static int cb_true(void *user_data, void *arg, int flags)
-{
+ return NULL;
+}
+
+static int clear_events_cb(void *user_data, void *arg, int flags)
+{
+ struct ast_calendar_event *event = user_data;
+
+ event = destroy_event(event);
+
return CMP_MATCH;
}
@@ -322,7 +327,7 @@
{
ast_debug(3, "Clearing all events for calendar %s\n", cal->name);
- ao2_callback(cal->events, OBJ_UNLINK | OBJ_NODATA | OBJ_MULTIPLE, cb_true, NULL);
+ ao2_callback(cal->events, OBJ_UNLINK | OBJ_NODATA | OBJ_MULTIPLE, clear_events_cb, NULL);
}
struct ast_calendar_event *ast_calendar_event_alloc(struct ast_calendar *cal)
@@ -403,8 +408,7 @@
goto notify_cleanup;
}
- ao2_lock(event);
-
+ ao2_ref(event, +1);
event->notify_sched = -1;
ast_copy_string(tech, event->owner->notify_channel, sizeof(tech));
@@ -468,7 +472,7 @@
res = 0;
notify_cleanup:
- ao2_unlock(event);
+ event = ast_calendar_unref_event(event);
if (res == -1 && dial) {
ast_dial_destroy(dial);
}
@@ -493,7 +497,7 @@
return 0;
}
- ao2_lock(event);
+ ao2_ref(event, +1);
is_end_event = event->end <= now.tv_sec;
@@ -511,7 +515,7 @@
ast_devstate_changed(AST_DEVICE_BUSY, "Calendar/%s", event->owner->name);
}
- ao2_unlock(event);
+ event = ast_calendar_unref_event(event);
return 0;
}
@@ -593,6 +597,7 @@
/* If we don't find the old_event in new_events, then we can safely delete the old_event */
if (!(new_event = find_event(new_events, old_event->uid))) {
+ old_event = destroy_event(old_event);
return CMP_MATCH;
}
Modified: team/twilson/calendaring/res/res_caldav.c
URL: http://svn.digium.com/view/asterisk/team/twilson/calendaring/res/res_caldav.c?view=diff&rev=166902&r1=166901&r2=166902
==============================================================================
--- team/twilson/calendaring/res/res_caldav.c (original)
+++ team/twilson/calendaring/res/res_caldav.c Tue Dec 30 13:28:51 2008
@@ -26,6 +26,8 @@
<depend>libxml2</depend>
***/
#include "asterisk.h"
+
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include <libical/ical.h>
#include <neon/ne_session.h>
Modified: team/twilson/calendaring/res/res_exchangecal.c
URL: http://svn.digium.com/view/asterisk/team/twilson/calendaring/res/res_exchangecal.c?view=diff&rev=166902&r1=166901&r2=166902
==============================================================================
--- team/twilson/calendaring/res/res_exchangecal.c (original)
+++ team/twilson/calendaring/res/res_exchangecal.c Tue Dec 30 13:28:51 2008
@@ -26,6 +26,8 @@
<depend>iksemel</depend>
***/
#include "asterisk.h"
+
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include <libical/ical.h>
#include <neon/ne_session.h>
Modified: team/twilson/calendaring/res/res_icalendar.c
URL: http://svn.digium.com/view/asterisk/team/twilson/calendaring/res/res_icalendar.c?view=diff&rev=166902&r1=166901&r2=166902
==============================================================================
--- team/twilson/calendaring/res/res_icalendar.c (original)
+++ team/twilson/calendaring/res/res_icalendar.c Tue Dec 30 13:28:51 2008
@@ -26,6 +26,8 @@
***/
#include "asterisk.h"
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
+
#include <libical/ical.h>
#include <neon/ne_session.h>
#include <neon/ne_uri.h>
More information about the asterisk-commits
mailing list