/soc/2013/ashmew2/filetransferX: 476c1dba93fd: removed main_loop...

Ashish Gupta ashmew2 at gmail.com
Sun Aug 18 07:53:45 EDT 2013


Changeset: 476c1dba93fd21e706314cf05d68a15b63a127ca
Author:	 Ashish Gupta <ashmew2 at gmail.com>
Date:	 2013-08-17 17:45 +0530
Branch:	 filetransferX
URL: https://hg.pidgin.im/soc/2013/ashmew2/filetransferX/rev/476c1dba93fd

Description:

removed main_loop_run()

diffstat:

 libpurple/protocols/jabber/google/google_session.c |  32 +++++++++++++++------
 1 files changed, 22 insertions(+), 10 deletions(-)

diffs (105 lines):

diff --git a/libpurple/protocols/jabber/google/google_session.c b/libpurple/protocols/jabber/google/google_session.c
--- a/libpurple/protocols/jabber/google/google_session.c
+++ b/libpurple/protocols/jabber/google/google_session.c
@@ -466,12 +466,14 @@ jabber_google_relay_response_session_ini
 
 		purple_debug_info("google_session", "Added relay candidates without a crash.\n");
 
-		purple_debug_info("google_session", "Trying to Set Relay IP : %s\n", relay_ip);
-		if(!nice_agent_set_relay_info (agent, share_session->stream_id, 0, relay_ip, relay_udp, relay_username,
+/*		purple_debug_info("google_session", "Trying to Set Relay IP : %s\n", relay_ip);*/
+
+/*		if(!nice_agent_set_relay_info (agent, share_session->stream_id, 1, relay_ip, relay_udp, relay_username,
 					      relay_password, NICE_RELAY_TYPE_TURN_UDP)) 
 			purple_debug_info("google_session","Setting Relay on Niceagent Failed..\n");
 		else
 			purple_debug_info("google_session","Setting Relay on Niceagent Succeeded..\n");
+/*TODO: Uncomment send_candidates below*/
 		gtalk_xfer_send_candidates(session);
 		return;
 	}
@@ -925,7 +927,9 @@ google_session_handle_info(JabberStream 
 	xmlnode_set_attrib(iq->node, "to", session->remote_jid);
 	jabber_iq_send(iq);
 	/*TODO: Finding a good place for calling prepare candidates*/
+	/*TODO: Uncomment prepare_candidates*/
 	gtalk_xfer_prepare_candidates(session);
+	purple_debug_info("google_session", "CANDIDATES PREPARED!!!!!!!!!\nprepare_candidates()?\n");
 }
 
 static void
@@ -1100,6 +1104,7 @@ gtalk_xfer_handle_candidates(JabberStrea
 	xmlnode *candidate_node;
 	GoogleAVSessionData *session_data = (GoogleAVSessionData*)session->session_data;
 	GoogleXferSessionData *share_session = session_data->share_session;
+	JabberIq *result;
 
 	purple_debug_info("google_session", "Inside gtalk_xfer_handle_candidates..\n");
 	
@@ -1141,6 +1146,11 @@ gtalk_xfer_handle_candidates(JabberStrea
 	}
 	
 	purple_debug_info("google_session", "Added remote candidate to Nice Agent.\n");	
+/*TODO: Send Result IQ as well*/
+	result = jabber_iq_new(js, JABBER_IQ_RESULT);
+	jabber_iq_set_id(result, iq_id);
+	xmlnode_set_attrib(result->node, "to", session->remote_jid);
+	jabber_iq_send(result);
 }
 
 static void
@@ -1482,7 +1492,7 @@ This will most probably end in successfu
 
 	GSList *lcands = NULL;
 	TempStruct *temp_struct = g_new0(TempStruct, 1);
-	GMainLoop *gloop;
+//	GMainLoop *gloop;
 	GoogleAVSessionData *session_data = (GoogleAVSessionData *)session->session_data;
 	GoogleXferSessionData *share_session = session_data->share_session;
 
@@ -1498,7 +1508,7 @@ This will most probably end in successfu
 	else
 		purple_debug_info("google_session", "Agent's stun was not NULL.");
 
-	gloop = g_main_loop_new(NULL, FALSE);
+//	gloop = g_main_loop_new(NULL, FALSE);
 
 /*Sending relay request to Google's Relay Server..*/
 	if (js->google_relay_host && js->google_relay_token) {
@@ -1528,7 +1538,7 @@ This will most probably end in successfu
    temp_struct->stream_id = stream_id;
 */
 	nice_agent_attach_recv (agent, stream_id, 1,
-				 g_main_loop_get_context (gloop), cb_nice_recv, NULL);
+				 g_main_context_default(), cb_nice_recv, NULL);
 /*				 TODO: REMOVE ME. Trying g_main_context_default () instead of gloop.*/
 /*
 	nice_agent_attach_recv (agent, stream_id, 1,
@@ -1549,12 +1559,14 @@ This will most probably end in successfu
 	else
 		purple_debug_info("google_session", "Gather Candidates returned TRUE\n");
 	
-	g_main_loop_run (gloop);
-	g_main_loop_unref(gloop); /*TODO: Check if gloop is causing a CRASH when Destroying pidgin instance*/
-	g_object_unref(agent); /*Something here is causing a CRASH on destroying pidgin..Find out what! TODO*/
+	purple_debug_info("google_session", "Before main_loop_run!\n");
+//	g_main_loop_run (gloop);
+	purple_debug_info("google_session", "After main_loop_run!\n");
+//	g_main_loop_unref(gloop); /*TODO: Check if gloop is causing a CRASH when Destroying pidgin instance*/
+//	g_object_unref(agent); /*Something here is causing a CRASH on destroying pidgin..Find out what! TODO*/
 
 	/*relay information gathering : */
-
+	purple_debug_info("google_session", "Returning from prepare_candidates()\n");
 	return;
 }
 
@@ -1781,7 +1793,7 @@ gtalk_xfer_init(PurpleXfer *xfer)
 	purple_debug_info("google_session", "We have a file now. Details of Xfer :\nwho : %s\nfilename:%s\nlocal_filename:%s\nsize:%d\nlocal_port : %d\nremote_port:%d\nremote_ip:%s\nBytes Sent:%d\nBytes Remaining:%d\n",xfer->who,xfer->filename,xfer->local_filename,xfer->size,xfer->local_port,xfer->remote_port,xfer->remote_ip,xfer->bytes_sent,xfer->bytes_remaining);
 
 	if(share_session) {
-		NiceAgent *agent = nice_agent_new_reliable (NULL, NICE_COMPATIBILITY_RFC5245);
+		NiceAgent *agent = nice_agent_new_reliable (g_main_context_default (), NICE_COMPATIBILITY_RFC5245);
 		guint stream_id;
 		stream_id = nice_agent_add_stream (agent, 1);
 		share_session->stream_id = stream_id;



More information about the Commits mailing list