pidgin: 3d639e6a: Use non-blocking io for direct xmpp file...

datallah at pidgin.im datallah at pidgin.im
Tue Aug 12 18:20:43 EDT 2008


-----------------------------------------------------------------
Revision: 3d639e6a8cacd7ad8179a443463a072ded0cbf3c
Ancestor: 95902c5039f926a7577c551f242480ab3dbb0582
Author: datallah at pidgin.im
Date: 2008-08-12T22:16:48
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/3d639e6a8cacd7ad8179a443463a072ded0cbf3c

Modified files:
        libpurple/protocols/jabber/si.c

ChangeLog: 

Use non-blocking io for direct xmpp file transfers

-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/si.c	4b09bb24a92388e97a79e473b80bb30051f593b7
+++ libpurple/protocols/jabber/si.c	5ed8249db39deb22fcd1104fdebd1501c38a5fd4
@@ -614,7 +614,7 @@ jabber_si_xfer_bytestreams_send_connecte
 {
 	PurpleXfer *xfer = data;
 	JabberSIXfer *jsx = xfer->data;
-	int acceptfd;
+	int acceptfd, flags;
 
 	purple_debug_info("jabber", "in jabber_si_xfer_bytestreams_send_connected_cb\n");
 
@@ -631,6 +631,12 @@ jabber_si_xfer_bytestreams_send_connecte
 	close(source);
 	jsx->local_streamhost_fd = -1;
 
+	flags = fcntl(acceptfd, F_GETFL);
+	fcntl(acceptfd, F_SETFL, flags | O_NONBLOCK);
+#ifndef _WIN32
+	fcntl(acceptfd, F_SETFD, FD_CLOEXEC);
+#endif
+
 	xfer->watcher = purple_input_add(acceptfd, PURPLE_INPUT_READ,
 					 jabber_si_xfer_bytestreams_send_read_cb, xfer);
 }
@@ -967,7 +973,7 @@ static void jabber_si_xfer_free(PurpleXf
 	g_free(jsx->rxqueue);
 	g_free(jsx);
 	xfer->data = NULL;
-	
+
 	purple_debug_info("jabber", "jabber_si_xfer_free(): freeing jsx %p", jsx);
 }
 


More information about the Commits mailing list