[asterisk-commits] twilson: branch twilson/calendaring r197693 - /team/twilson/calendaring/res/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu May 28 13:13:54 CDT 2009


Author: twilson
Date: Thu May 28 13:13:51 2009
New Revision: 197693

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=197693
Log:
Fix log message and add trylock code to other tech modules

Modified:
    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/res/res_caldav.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/twilson/calendaring/res/res_caldav.c?view=diff&rev=197693&r1=197692&r2=197693
==============================================================================
--- team/twilson/calendaring/res/res_caldav.c (original)
+++ team/twilson/calendaring/res/res_caldav.c Thu May 28 13:13:51 2009
@@ -549,7 +549,7 @@
 		if (cal->unloading) {
 			ast_log(LOG_WARNING, "Unloading module, load_calendar cancelled.\n");
 		} else {
-			ast_log(LOG_WARNING, "Could not lock calendar, which is totally freaking me out. I give up.\n");
+			ast_log(LOG_WARNING, "Could not lock calendar, aborting!\n");
 		}
 		return NULL;
 	}

Modified: team/twilson/calendaring/res/res_exchangecal.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/twilson/calendaring/res/res_exchangecal.c?view=diff&rev=197693&r1=197692&r2=197693
==============================================================================
--- team/twilson/calendaring/res/res_exchangecal.c (original)
+++ team/twilson/calendaring/res/res_exchangecal.c Thu May 28 13:13:51 2009
@@ -628,12 +628,19 @@
 		return NULL;
 	}
 
+	if (ao2_trylock(cal)) {
+		if (cal->unloading) {
+			ast_log(LOG_WARNING, "Unloading module, load_calendar cancelled.\n");
+		} else {
+			ast_log(LOG_WARNING, "Could not lock calendar, aborting!\n");
+		}
+		return NULL;
+	}
+
 	if (!(pvt = ao2_alloc(sizeof(*pvt), exchangecal_destructor))) {
 		ast_log(LOG_ERROR, "Could not allocate exchangecal_pvt structure for calendar: %s\n", cal->name);
 		return NULL;
 	}
-
-	ao2_lock(cal);
 
 	pvt->owner = cal;
 

Modified: team/twilson/calendaring/res/res_icalendar.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/twilson/calendaring/res/res_icalendar.c?view=diff&rev=197693&r1=197692&r2=197693
==============================================================================
--- team/twilson/calendaring/res/res_icalendar.c (original)
+++ team/twilson/calendaring/res/res_icalendar.c Thu May 28 13:13:51 2009
@@ -332,13 +332,19 @@
 		ast_log(LOG_ERROR, "You must enable calendar support for res_icalendar to load\n");
 		return NULL;
 	}
+	if (ao2_trylock(cal)) {
+		if (cal->unloading) {
+			ast_log(LOG_WARNING, "Unloading module, load_calendar cancelled.\n");
+		} else {
+			ast_log(LOG_WARNING, "Could not lock calendar, aborting!\n");
+		}
+		return NULL;
+	}
 
 	if (!(pvt = ao2_alloc(sizeof(*pvt), icalendar_destructor))) {
 		ast_log(LOG_ERROR, "Could not allocate icalendar_pvt structure for calendar: %s\n", cal->name);
 		return NULL;
 	}
-
-	ao2_lock(cal);
 
 	pvt->owner = cal;
 




More information about the asterisk-commits mailing list