pidgin: 8de94491: Use non-blocking io for inbound TCP conn...

datallah at pidgin.im datallah at pidgin.im
Tue Aug 12 19:26:00 EDT 2008


-----------------------------------------------------------------
Revision: 8de944912416e9ae69c8bf505a787ceb54256274
Ancestor: 3c5570eb19f5f8128c41aec6053f2c89130bfb5f
Author: datallah at pidgin.im
Date: 2008-08-12T23:09:05
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/8de944912416e9ae69c8bf505a787ceb54256274

Modified files:
        libpurple/protocols/simple/simple.c

ChangeLog: 

Use non-blocking io for inbound TCP connections for SIMPLE.

-------------- next part --------------
============================================================
--- libpurple/protocols/simple/simple.c	168ad0960a4fb23715e11458957addd50d10c765
+++ libpurple/protocols/simple/simple.c	42fc9ca312f0f4aff9bde7d8be531fbc0e7d9b50
@@ -1703,9 +1703,16 @@ static void simple_newconn_cb(gpointer d
 	PurpleConnection *gc = data;
 	struct simple_account_data *sip = gc->proto_data;
 	struct sip_connection *conn;
+	int newfd, flags;
 
-	int newfd = accept(source, NULL, NULL);
+	newfd = accept(source, NULL, NULL);
 
+	flags = fcntl(newfd, F_GETFL);
+	fcntl(newfd, F_SETFL, flags | O_NONBLOCK);
+#ifndef _WIN32
+	fcntl(newfd, F_SETFD, FD_CLOEXEC);
+#endif
+
 	conn = connection_create(sip, newfd);
 
 	conn->inputhandler = purple_input_add(newfd, PURPLE_INPUT_READ, simple_input_cb, gc);


More information about the Commits mailing list