Mercurial > pidgin
comparison src/rvous.c @ 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 | b2f9f629525e |
comparison
equal
deleted
inserted
replaced
217:fba779cc01f5 | 218:1a5ee1f8b39e |
---|---|
30 #include <netdb.h> | 30 #include <netdb.h> |
31 #include <netinet/in.h> | 31 #include <netinet/in.h> |
32 #include <unistd.h> | 32 #include <unistd.h> |
33 #include <netinet/in.h> | 33 #include <netinet/in.h> |
34 #include <arpa/inet.h> | 34 #include <arpa/inet.h> |
35 | 35 #include <errno.h> |
36 #include <gtk/gtk.h> | 36 #include <gtk/gtk.h> |
37 #include "gaim.h" | 37 #include "gaim.h" |
38 | 38 |
39 static void do_send_file(GtkWidget *, struct file_transfer *); | 39 static void do_send_file(GtkWidget *, struct file_transfer *); |
40 static void do_get_file (GtkWidget *, struct file_transfer *); | 40 static void do_get_file (GtkWidget *, struct file_transfer *); |
264 | 264 |
265 sprintf(debug_buff, "Receiving %s from %s (%d bytes)\n", ft->filename, | 265 sprintf(debug_buff, "Receiving %s from %s (%d bytes)\n", ft->filename, |
266 ft->user, ft->size); | 266 ft->user, ft->size); |
267 debug_print(debug_buff); | 267 debug_print(debug_buff); |
268 | 268 |
269 fcntl(ft->fd, F_SETFL, O_NONBLOCK); | |
270 | |
269 while (rcv != ft->size && cont) { | 271 while (rcv != ft->size && cont) { |
270 int i; | 272 int i; |
271 float pcnt = ((float)rcv)/((float)ft->size); | 273 float pcnt = ((float)rcv)/((float)ft->size); |
272 int remain = ft->size - rcv > 1024 ? 1024 : ft->size - rcv; | 274 int remain = ft->size - rcv > 1024 ? 1024 : ft->size - rcv; |
273 read_rv = recv(ft->fd, buf, remain, O_NONBLOCK); | 275 read_rv = read(ft->fd, buf, remain); |
274 if(read_rv < 0) { | 276 if(read_rv < 0) { |
277 if (errno == EWOULDBLOCK) { | |
278 while(gtk_events_pending()) | |
279 gtk_main_iteration(); | |
280 continue; | |
281 } | |
275 fclose(ft->f); | 282 fclose(ft->f); |
276 close(ft->fd); | 283 close(ft->fd); |
277 g_free(buf); | 284 g_free(buf); |
278 g_free(header); | 285 g_free(header); |
279 free_ft(ft); | 286 free_ft(ft); |