X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=src%2Fftp.c;fp=src%2Fftp.c;h=8a9b4ab2cd1653c6c2ad9f4eaf6b9a4ce325e96d;hb=8b4d2adf48213f2bf74ca1a423b1ac3dc8066f95;hp=f62a3a42c1b53a88357b2373455b55a6807463cc;hpb=6120587cce15206faa7a38207961a89110de3bcd;p=oftp diff --git a/src/ftp.c b/src/ftp.c index f62a3a4..8a9b4ab 100644 --- a/src/ftp.c +++ b/src/ftp.c @@ -486,13 +486,16 @@ static int handle_control(struct ftp *ftp) static int handle_data(struct ftp *ftp, int s) { - int rd; + int i, rd; if(ftp->data == -1) { return -1; } - for(;;) { + /* get at most 4 packets at a time, to allow returning back to the main loop + * to process input + */ + for(i=0; i<4; i++) { if((rd = recv(ftp->data, ftp->drecv, sizeof ftp->drecv, 0)) == -1) { if(errno == EINTR) continue; /* assume EWOULDBLOCK, try again next time */