[asterisk-commits] mjordan: branch mjordan/cdrs-of-doom r387018 - in /team/mjordan/cdrs-of-doom:...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Apr 30 14:54:48 CDT 2013


Author: mjordan
Date: Tue Apr 30 14:54:44 2013
New Revision: 387018

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=387018
Log:
Automerge re-enabled

Modified:
    team/mjordan/cdrs-of-doom/   (props changed)
    team/mjordan/cdrs-of-doom/channels/chan_gulp.c
    team/mjordan/cdrs-of-doom/include/asterisk/utils.h
    team/mjordan/cdrs-of-doom/res/res_stasis_http.c
    team/mjordan/cdrs-of-doom/tests/test_stasis_http.c

Propchange: team/mjordan/cdrs-of-doom/
------------------------------------------------------------------------------
    automerge = *

Propchange: team/mjordan/cdrs-of-doom/
------------------------------------------------------------------------------
Binary property 'branch-11-merged' - no diff available.

Propchange: team/mjordan/cdrs-of-doom/
------------------------------------------------------------------------------
--- cdrs-of-doom-integrated (original)
+++ cdrs-of-doom-integrated Tue Apr 30 14:54:44 2013
@@ -1,1 +1,1 @@
-/team/group/bridge_construction:1-386923
+/team/group/bridge_construction:1-387017

Modified: team/mjordan/cdrs-of-doom/channels/chan_gulp.c
URL: http://svnview.digium.com/svn/asterisk/team/mjordan/cdrs-of-doom/channels/chan_gulp.c?view=diff&rev=387018&r1=387017&r2=387018
==============================================================================
--- team/mjordan/cdrs-of-doom/channels/chan_gulp.c (original)
+++ team/mjordan/cdrs-of-doom/channels/chan_gulp.c Tue Apr 30 14:54:44 2013
@@ -785,7 +785,7 @@
 		if (ind_data) {
 			res = ast_sip_push_task(session->serializer, indicate, ind_data);
 			if (res) {
-				ast_log(LOG_NOTICE, "Cannot send response code %d to endpoint %s. Could queue task properly\n",
+				ast_log(LOG_NOTICE, "Cannot send response code %d to endpoint %s. Could not queue task properly\n",
 						response_code, ast_sorcery_object_get_id(session->endpoint));
 				ao2_cleanup(ind_data);
 			}

Modified: team/mjordan/cdrs-of-doom/include/asterisk/utils.h
URL: http://svnview.digium.com/svn/asterisk/team/mjordan/cdrs-of-doom/include/asterisk/utils.h?view=diff&rev=387018&r1=387017&r2=387018
==============================================================================
--- team/mjordan/cdrs-of-doom/include/asterisk/utils.h (original)
+++ team/mjordan/cdrs-of-doom/include/asterisk/utils.h Tue Apr 30 14:54:44 2013
@@ -324,8 +324,8 @@
 	res = (int) *input + *value;
 	if (res > 32767)
 		*input = 32767;
-	else if (res < -32767)
-		*input = -32767;
+	else if (res < -32768)
+		*input = -32768;
 	else
 		*input = (short) res;
 }
@@ -337,8 +337,8 @@
 	res = (int) *input - *value;
 	if (res > 32767)
 		*input = 32767;
-	else if (res < -32767)
-		*input = -32767;
+	else if (res < -32768)
+		*input = -32768;
 	else
 		*input = (short) res;
 }
@@ -350,8 +350,8 @@
 	res = (int) *input * *value;
 	if (res > 32767)
 		*input = 32767;
-	else if (res < -32767)
-		*input = -32767;
+	else if (res < -32768)
+		*input = -32768;
 	else
 		*input = (short) res;
 }

Modified: team/mjordan/cdrs-of-doom/res/res_stasis_http.c
URL: http://svnview.digium.com/svn/asterisk/team/mjordan/cdrs-of-doom/res/res_stasis_http.c?view=diff&rev=387018&r1=387017&r2=387018
==============================================================================
--- team/mjordan/cdrs-of-doom/res/res_stasis_http.c (original)
+++ team/mjordan/cdrs-of-doom/res/res_stasis_http.c Tue Apr 30 14:54:44 2013
@@ -241,14 +241,17 @@
 int stasis_http_remove_handler(struct stasis_rest_handlers *handler)
 {
 	RAII_VAR(struct stasis_rest_handlers *, new_handler, NULL, ao2_cleanup);
-	size_t old_size, new_size, i, j;
-
-	SCOPED_MUTEX(lock, &root_handler_lock);
-	old_size = sizeof(*new_handler) +
+	size_t size, i, j;
+
+	if (!root_handler) {
+		return -1;
+	}
+
+	ast_mutex_lock(&root_handler_lock);
+	size = sizeof(*new_handler) +
 		root_handler->num_children * sizeof(handler);
-	new_size = old_size - sizeof(handler);
-
-	new_handler = ao2_alloc(new_size, NULL);
+
+	new_handler = ao2_alloc(size, NULL);
 	if (!new_handler) {
 		return -1;
 	}
@@ -265,6 +268,7 @@
 	ao2_cleanup(root_handler);
 	ao2_ref(new_handler, +1);
 	root_handler = new_handler;
+	ast_mutex_unlock(&root_handler_lock);
 	return 0;
 }
 
@@ -899,6 +903,7 @@
 	ao2_global_obj_release(confs);
 
 	ao2_cleanup(root_handler);
+	root_handler = NULL;
 	ast_mutex_destroy(&root_handler_lock);
 
 	return 0;

Modified: team/mjordan/cdrs-of-doom/tests/test_stasis_http.c
URL: http://svnview.digium.com/svn/asterisk/team/mjordan/cdrs-of-doom/tests/test_stasis_http.c?view=diff&rev=387018&r1=387017&r2=387018
==============================================================================
--- team/mjordan/cdrs-of-doom/tests/test_stasis_http.c (original)
+++ team/mjordan/cdrs-of-doom/tests/test_stasis_http.c Tue Apr 30 14:54:44 2013
@@ -164,6 +164,9 @@
  */
 static void response_free(struct stasis_http_response *resp)
 {
+	if (!resp) {
+		return;
+	}
 	ast_free(resp->headers);
 	ast_json_unref(resp->message);
 	ast_free(resp);
@@ -178,7 +181,7 @@
 	invocation_count = 0;
 	r = stasis_http_add_handler(&test_root);
 	ast_assert(r == 0);
-	return NULL;
+	return &invocation_count;
 }
 
 /*!
@@ -186,13 +189,16 @@
  * Tear down test fixture for invocation tests.
  */
 static void tear_down_invocation_test(void *ignore) {
+	if (!ignore) {
+		return;
+	}
 	stasis_http_remove_handler(&test_root);
 }
 
 
 AST_TEST_DEFINE(get_docs)
 {
-	RAII_VAR(struct stasis_http_response *, response, response_alloc(), response_free);
+	RAII_VAR(struct stasis_http_response *, response, NULL, response_free);
 	RAII_VAR(struct ast_variable *, headers, NULL, ast_variables_destroy);
 	struct ast_json *basePathJson;
 	const char *basePath;
@@ -208,6 +214,7 @@
 		break;
 	}
 
+	response = response_alloc();
 	headers = ast_variable_new("Host", "stasis.asterisk.org", __FILE__);
 	stasis_http_get_docs("resources.json", headers, response);
 	ast_test_validate(test, 200 == response->response_code);
@@ -223,7 +230,7 @@
 
 AST_TEST_DEFINE(get_docs_nohost)
 {
-	RAII_VAR(struct stasis_http_response *, response, response_alloc(), response_free);
+	RAII_VAR(struct stasis_http_response *, response, NULL, response_free);
 	struct ast_variable *headers = NULL;
 	struct ast_json *basePathJson;
 
@@ -238,6 +245,7 @@
 		break;
 	}
 
+	response = response_alloc();
 	stasis_http_get_docs("resources.json", headers, response);
 	ast_test_validate(test, 200 == response->response_code);
 
@@ -250,7 +258,7 @@
 
 AST_TEST_DEFINE(get_docs_notfound)
 {
-	RAII_VAR(struct stasis_http_response *, response, response_alloc(), response_free);
+	RAII_VAR(struct stasis_http_response *, response, NULL, response_free);
 	struct ast_variable *headers = NULL;
 
 	switch (cmd) {
@@ -264,6 +272,7 @@
 		break;
 	}
 
+	response = response_alloc();
 	stasis_http_get_docs("i-am-not-a-resource.json", headers, response);
 	ast_test_validate(test, 404 == response->response_code);
 
@@ -272,7 +281,7 @@
 
 AST_TEST_DEFINE(get_docs_hackerz)
 {
-	RAII_VAR(struct stasis_http_response *, response, response_alloc(), response_free);
+	RAII_VAR(struct stasis_http_response *, response, NULL, response_free);
 	struct ast_variable *headers = NULL;
 
 	switch (cmd) {
@@ -286,6 +295,7 @@
 		break;
 	}
 
+	response = response_alloc();
 	stasis_http_get_docs("../../../../sbin/asterisk", headers, response);
 	ast_test_validate(test, 404 == response->response_code);
 
@@ -294,8 +304,8 @@
 
 AST_TEST_DEFINE(invoke_get)
 {
-	RAII_VAR(void *, fixture, setup_invocation_test(), tear_down_invocation_test);
-	RAII_VAR(struct stasis_http_response *, response, response_alloc(), response_free);
+	RAII_VAR(void *, fixture, NULL, tear_down_invocation_test);
+	RAII_VAR(struct stasis_http_response *, response, NULL, response_free);
 	RAII_VAR(struct ast_json *, expected, NULL, ast_json_unref);
 	struct ast_variable *get_params = NULL;
 	struct ast_variable *headers = NULL;
@@ -311,6 +321,8 @@
 		break;
 	}
 
+	fixture = setup_invocation_test();
+	response = response_alloc();
 	get_params = ast_variable_new("get1", "get-one", __FILE__);
 	ast_assert(get_params != NULL);
 	get_params->next = ast_variable_new("get2", "get-two", __FILE__);
@@ -342,8 +354,8 @@
 
 AST_TEST_DEFINE(invoke_wildcard)
 {
-	RAII_VAR(void *, fixture, setup_invocation_test(), tear_down_invocation_test);
-	RAII_VAR(struct stasis_http_response *, response, response_alloc(), response_free);
+	RAII_VAR(void *, fixture, NULL, tear_down_invocation_test);
+	RAII_VAR(struct stasis_http_response *, response, NULL, response_free);
 	RAII_VAR(struct ast_json *, expected, NULL, ast_json_unref);
 	struct ast_variable *get_params = NULL;
 	struct ast_variable *headers = NULL;
@@ -359,6 +371,8 @@
 		break;
 	}
 
+	fixture = setup_invocation_test();
+	response = response_alloc();
 	expected = ast_json_pack("{s: s, s: {}, s: {}, s: {s: s}}",
 				 "name", "bam_get",
 				 "get_params",
@@ -377,8 +391,8 @@
 
 AST_TEST_DEFINE(invoke_delete)
 {
-	RAII_VAR(void *, fixture, setup_invocation_test(), tear_down_invocation_test);
-	RAII_VAR(struct stasis_http_response *, response, response_alloc(), response_free);
+	RAII_VAR(void *, fixture, NULL, tear_down_invocation_test);
+	RAII_VAR(struct stasis_http_response *, response, NULL, response_free);
 	RAII_VAR(struct ast_json *, expected, NULL, ast_json_unref);
 	struct ast_variable *get_params = NULL;
 	struct ast_variable *headers = NULL;
@@ -394,6 +408,8 @@
 		break;
 	}
 
+	fixture = setup_invocation_test();
+	response = response_alloc();
 	expected = ast_json_pack("{s: s, s: {}, s: {}, s: {s: s}}",
 				 "name", "bang_delete",
 				 "get_params",
@@ -412,8 +428,8 @@
 
 AST_TEST_DEFINE(invoke_post)
 {
-	RAII_VAR(void *, fixture, setup_invocation_test(), tear_down_invocation_test);
-	RAII_VAR(struct stasis_http_response *, response, response_alloc(), response_free);
+	RAII_VAR(void *, fixture, NULL, tear_down_invocation_test);
+	RAII_VAR(struct stasis_http_response *, response, NULL, response_free);
 	RAII_VAR(struct ast_json *, expected, NULL, ast_json_unref);
 	struct ast_variable *get_params = NULL;
 	struct ast_variable *headers = NULL;
@@ -429,6 +445,8 @@
 		break;
 	}
 
+	fixture = setup_invocation_test();
+	response = response_alloc();
 	get_params = ast_variable_new("get1", "get-one", __FILE__);
 	ast_assert(get_params != NULL);
 	get_params->next = ast_variable_new("get2", "get-two", __FILE__);
@@ -460,8 +478,8 @@
 
 AST_TEST_DEFINE(invoke_bad_post)
 {
-	RAII_VAR(void *, fixture, setup_invocation_test(), tear_down_invocation_test);
-	RAII_VAR(struct stasis_http_response *, response, response_alloc(), response_free);
+	RAII_VAR(void *, fixture, NULL, tear_down_invocation_test);
+	RAII_VAR(struct stasis_http_response *, response, NULL, response_free);
 	struct ast_variable *get_params = NULL;
 	struct ast_variable *headers = NULL;
 
@@ -476,6 +494,8 @@
 		break;
 	}
 
+	fixture = setup_invocation_test();
+	response = response_alloc();
 	stasis_http_invoke("foo", AST_HTTP_POST, get_params, headers, response);
 
 	ast_test_validate(test, 0 == invocation_count);
@@ -486,8 +506,8 @@
 
 AST_TEST_DEFINE(invoke_not_found)
 {
-	RAII_VAR(void *, fixture, setup_invocation_test(), tear_down_invocation_test);
-	RAII_VAR(struct stasis_http_response *, response, response_alloc(), response_free);
+	RAII_VAR(void *, fixture, NULL, tear_down_invocation_test);
+	RAII_VAR(struct stasis_http_response *, response, NULL, response_free);
 	struct ast_variable *get_params = NULL;
 	struct ast_variable *headers = NULL;
 
@@ -502,6 +522,8 @@
 		break;
 	}
 
+	fixture = setup_invocation_test();
+	response = response_alloc();
 	stasis_http_invoke("foo/fizzle/i-am-not-a-resource", AST_HTTP_GET, get_params, headers, response);
 
 	ast_test_validate(test, 0 == invocation_count);




More information about the asterisk-commits mailing list