pidgin: 4afa4564: Use non-blocking io for IRC DCC transfer...

datallah at pidgin.im datallah at pidgin.im
Tue Aug 12 19:25:49 EDT 2008


-----------------------------------------------------------------
Revision: 4afa45644550a37af63bc3c1be176f9b72aedb75
Ancestor: 7daf4653c3d8ee31a374695cc1c18e8a82d64b0a
Author: datallah at pidgin.im
Date: 2008-08-12T23:22:47
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/4afa45644550a37af63bc3c1be176f9b72aedb75

Modified files:
        libpurple/protocols/irc/dcc_send.c

ChangeLog: 

Use non-blocking io for IRC DCC transfers.

-------------- next part --------------
============================================================
--- libpurple/protocols/irc/dcc_send.c	1a4fa8f4acbf9eba0975da0c127750e6c9021c38
+++ libpurple/protocols/irc/dcc_send.c	fbc1e0ff48829a15cda4740ae94b95b4d8451a13
@@ -245,7 +245,7 @@ static void irc_dccsend_send_connected(g
 static void irc_dccsend_send_connected(gpointer data, int source, PurpleInputCondition cond) {
 	PurpleXfer *xfer = (PurpleXfer *) data;
 	struct irc_xfer_send_data *xd = xfer->data;
-	int conn;
+	int conn, flags;
 
 	conn = accept(xd->fd, NULL, 0);
 	if (conn == -1) {
@@ -262,6 +262,12 @@ static void irc_dccsend_send_connected(g
 	close(xd->fd);
 	xd->fd = -1;
 
+	flags = fcntl(conn, F_GETFL);
+	fcntl(conn, F_SETFL, flags | O_NONBLOCK);
+#ifndef _WIN32
+	fcntl(conn, F_SETFD, FD_CLOEXEC);
+#endif
+
 	xd->inpa = purple_input_add(conn, PURPLE_INPUT_READ, irc_dccsend_send_read, xfer);
 	/* Start the transfer */
 	purple_xfer_start(xfer, conn, NULL, 0);


More information about the Commits mailing list