Revision
16764
Author
sathieu
Date
2010-02-24 06:00:04 -0600 (Wed, 24 Feb 2010)

Log Message

Skinny:
- don't free skinny messages as they are handled by pools
- correct devices autocompletion (inspired by switch_console_list_uuid in switch_console.c)

Modified Paths

Diff

Modified: freeswitch/trunk/src/mod/endpoints/mod_skinny/mod_skinny.c (16763 => 16764)


--- freeswitch/trunk/src/mod/endpoints/mod_skinny/mod_skinny.c	2010-02-24 11:59:56 UTC (rev 16763)
+++ freeswitch/trunk/src/mod/endpoints/mod_skinny/mod_skinny.c	2010-02-24 12:00:04 UTC (rev 16764)
@@ -1381,15 +1381,6 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
-static switch_status_t skinny_free_message(skinny_message_t *message)
-{
-	if(message) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Freeing message\n");
-		/* TODO */
-	}
-	return SWITCH_STATUS_SUCCESS;
-}
-
 /*****************************************************************************/
 /* LISTENER FUNCTIONS */
 /*****************************************************************************/
@@ -1552,7 +1543,6 @@
 	switch_core_session_t *session = NULL;
 	switch_channel_t *channel = NULL;
 	skinny_message_t *request = NULL;
-	skinny_message_t *reply = NULL;
 	skinny_profile_t *profile;
 	switch_assert(listener);
 	assert(listener->profile);
@@ -1605,14 +1595,10 @@
 			break;
 		}
 
-		skinny_free_message(request);
 	}
 
   done:
 	
-	skinny_free_message(request);
-	skinny_free_message(reply);
-	
 	remove_listener(listener);
 
 	if (globals.debug > 0) {
@@ -2023,21 +2009,22 @@
 	return status;
 }
 
+struct match_helper {
+	switch_console_callback_match_t *my_matches;
+};
+
 static int skinny_list_devices_callback(void *pArg, int argc, char **argv, char **columnNames)
 {
-	switch_console_callback_match_t *my_matches = (switch_console_callback_match_t *) pArg;
-
+	struct match_helper *h = (struct match_helper *) pArg;
 	char *device_name = argv[0];
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO,
-		"Adding %s to matches.\n", device_name);
-	switch_console_push_match(&my_matches, device_name);
-	pArg = my_matches;
+
+	switch_console_push_match(&h->my_matches, device_name);
 	return 0;
 }
 
 static switch_status_t skinny_list_devices(const char *line, const char *cursor, switch_console_callback_match_t **matches)
 {
-	switch_console_callback_match_t *my_matches = NULL;
+	struct match_helper h = { 0 };
 	switch_status_t status = SWITCH_STATUS_FALSE;
 	skinny_profile_t *profile;
 	char *sql;
@@ -2056,13 +2043,13 @@
 
 	if((profile = get_profile(argv[3]))) {
 		if ((sql = switch_mprintf("SELECT device_name FROM skinny_devices"))) {
-			skinny_execute_sql_callback(profile, profile->listener_mutex, sql, skinny_list_devices_callback, my_matches);
+			skinny_execute_sql_callback(profile, profile->listener_mutex, sql, skinny_list_devices_callback, &h);
 			switch_safe_free(sql);
 		}
 	}
 	
-	if (my_matches) {
-		*matches = my_matches;
+	if (h.my_matches) {
+		*matches = h.my_matches;
 		status = SWITCH_STATUS_SUCCESS;
 	}