changeset 23769:e21c79681c96

Use non-blocking io for direct xmpp file transfers
author Daniel Atallah <daniel.atallah@gmail.com>
date Tue, 12 Aug 2008 22:16:48 +0000
parents 18cdf05dd039
children 0dd3df365017
files libpurple/protocols/jabber/si.c
diffstat 1 files changed, 8 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/jabber/si.c	Tue Aug 12 15:24:06 2008 +0000
+++ b/libpurple/protocols/jabber/si.c	Tue Aug 12 22:16:48 2008 +0000
@@ -614,7 +614,7 @@
 {
 	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 @@
 	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 @@
 	g_free(jsx->rxqueue);
 	g_free(jsx);
 	xfer->data = NULL;
-	
+
 	purple_debug_info("jabber", "jabber_si_xfer_free(): freeing jsx %p", jsx);
 }