changeset 218:1a5ee1f8b39e

[gaim-migrate @ 228] Correctly inits the non blocking stuff committer: Tailor Script <tailor@pidgin.im>
author Rob Flynn <gaim@robflynn.com>
date Sat, 06 May 2000 21:50:31 +0000
parents fba779cc01f5
children 5964b4a06f41
files src/rvous.c
diffstat 1 files changed, 9 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/rvous.c	Fri May 05 22:33:38 2000 +0000
+++ b/src/rvous.c	Sat May 06 21:50:31 2000 +0000
@@ -32,7 +32,7 @@
 #include <unistd.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>
-
+#include <errno.h>
 #include <gtk/gtk.h>
 #include "gaim.h"
 
@@ -266,12 +266,19 @@
 			ft->user, ft->size);
 	debug_print(debug_buff);
 
+	fcntl(ft->fd, F_SETFL, O_NONBLOCK);
+
 	while (rcv != ft->size && cont) {
 		int i;
 		float pcnt = ((float)rcv)/((float)ft->size);
 		int remain = ft->size - rcv > 1024 ? 1024 : ft->size - rcv;
-		read_rv = recv(ft->fd, buf, remain, O_NONBLOCK);
+		read_rv = read(ft->fd, buf, remain);
 		if(read_rv < 0) {
+			if (errno == EWOULDBLOCK) {
+				while(gtk_events_pending())
+					gtk_main_iteration();
+				continue;
+			}
 			fclose(ft->f);
 			close(ft->fd);
 			g_free(buf);