Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/ftp let progressmeter deal with the timeout once we'...



details:   https://anonhg.NetBSD.org/src/rev/8984a7f4478f
branches:  trunk
changeset: 791076:8984a7f4478f
user:      christos <christos%NetBSD.org@localhost>
date:      Sun Nov 03 14:45:50 2013 +0000

description:
let progressmeter deal with the timeout once we've started transferring.

diffstat:

 usr.bin/ftp/fetch.c |  14 ++++++--------
 1 files changed, 6 insertions(+), 8 deletions(-)

diffs (67 lines):

diff -r 2103d1d70c90 -r 8984a7f4478f usr.bin/ftp/fetch.c
--- a/usr.bin/ftp/fetch.c       Sun Nov 03 08:33:00 2013 +0000
+++ b/usr.bin/ftp/fetch.c       Sun Nov 03 14:45:50 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fetch.c,v 1.203 2013/11/02 19:55:47 christos Exp $     */
+/*     $NetBSD: fetch.c,v 1.204 2013/11/03 14:45:50 christos Exp $     */
 
 /*-
  * Copyright (c) 1997-2009 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: fetch.c,v 1.203 2013/11/02 19:55:47 christos Exp $");
+__RCSID("$NetBSD: fetch.c,v 1.204 2013/11/03 14:45:50 christos Exp $");
 #endif /* not lint */
 
 /*
@@ -1203,6 +1203,10 @@
 
        bytes = 0;
        hashbytes = mark;
+       if (oldalrm) {
+               (void)xsignal(SIGALRM, oldalrm);
+               oldalrm = NULL;
+       }
        progressmeter(-1);
 
                        /* Finally, suck down the file. */
@@ -1214,12 +1218,10 @@
                lastchunk = 0;
                                        /* read chunk-size */
                if (ischunked) {
-                       alarmtimer(quit_time ? quit_time : 60);
                        if (fetch_getln(xferbuf, bufsize, fin) == NULL) {
                                warnx("Unexpected EOF reading chunk-size");
                                goto cleanup_fetch_url;
                        }
-                       alarmtimer(0);
                        errno = 0;
                        chunksize = strtol(xferbuf, &ep, 16);
                        if (ep == xferbuf) {
@@ -1269,10 +1271,8 @@
                        if (ischunked)
                                bufrem = MIN(chunksize, bufrem);
                        while (bufrem > 0) {
-                               alarmtimer(quit_time ? quit_time : 60);
                                flen = fetch_read(xferbuf, sizeof(char),
                                    MIN((off_t)bufsize, bufrem), fin);
-                               alarmtimer(0);
                                if (flen <= 0)
                                        goto chunkdone;
                                bytes += flen;
@@ -1310,13 +1310,11 @@
                                        /* read CRLF after chunk*/
  chunkdone:
                if (ischunked) {
-                       alarmtimer(quit_time ? quit_time : 60);
                        if (fetch_getln(xferbuf, bufsize, fin) == NULL) {
                                alarmtimer(0);
                                warnx("Unexpected EOF reading chunk CRLF");
                                goto cleanup_fetch_url;
                        }
-                       alarmtimer(0);
                        if (strcmp(xferbuf, "\r\n") != 0) {
                                warnx("Unexpected data following chunk");
                                goto cleanup_fetch_url;



Home | Main Index | Thread Index | Old Index