summaryrefslogtreecommitdiff
path: root/libexec
diff options
context:
space:
mode:
authorlukem <lukem@NetBSD.org>2000-06-20 07:39:46 +0000
committerlukem <lukem@NetBSD.org>2000-06-20 07:39:46 +0000
commit327792f9ed3d6e97414ea35f74e4cf8fd385a441 (patch)
treeb5736be5d097f205036837f35d30b4f1f88f45d2 /libexec
parent0fa81d157430eefa6de8860f6d0a36c35004d7b2 (diff)
fix problems noted by <dogcow@redback.com> in [bin/10390] and private email:
* fix RATE{GET,PUT} under some situations when the client is slower than the server (something i missed when migrating the rate limiting code i wrote in ftp(1) to ftpd(8)) * document what units RATE{GET,PUT} use
Diffstat (limited to 'libexec')
-rw-r--r--libexec/ftpd/ftpd.86
-rw-r--r--libexec/ftpd/ftpd.c14
-rw-r--r--libexec/ftpd/ftpd.conf.510
3 files changed, 15 insertions, 15 deletions
diff --git a/libexec/ftpd/ftpd.8 b/libexec/ftpd/ftpd.8
index 40219cbcad5..20bb0578887 100644
--- a/libexec/ftpd/ftpd.8
+++ b/libexec/ftpd/ftpd.8
@@ -1,4 +1,4 @@
-.\" $NetBSD: ftpd.8,v 1.53 2000/06/19 15:15:04 lukem Exp $
+.\" $NetBSD: ftpd.8,v 1.54 2000/06/20 07:39:46 lukem Exp $
.\"
.\" Copyright (c) 1997-2000 The NetBSD Foundation, Inc.
.\" All rights reserved.
@@ -243,8 +243,8 @@ specific commands are supported by the SITE request.
.It CHMOD Ta "change mode of a file, e.g. ``SITE CHMOD 755 filename''"
.It HELP Ta "give help information."
.It IDLE Ta "set idle-timer, e.g. ``SITE IDLE 60''"
-.It RATEGET Ta "set maximum get rate throttle, e.g. ``SITE RATEGET 5k''"
-.It RATEPUT Ta "set maximum put rate throttle, e.g. ``SITE RATEPUT 5k''"
+.It RATEGET Ta "set maximum get rate throttle in bytes/second, e.g. ``SITE RATEGET 5k''"
+.It RATEPUT Ta "set maximum put rate throttle in bytes/second, e.g. ``SITE RATEPUT 5k''"
.It UMASK Ta "change umask, e.g. ``SITE UMASK 002''"
.El
.Pp
diff --git a/libexec/ftpd/ftpd.c b/libexec/ftpd/ftpd.c
index aa75eed4705..6278cfdee0d 100644
--- a/libexec/ftpd/ftpd.c
+++ b/libexec/ftpd/ftpd.c
@@ -1,4 +1,4 @@
-/* $NetBSD: ftpd.c,v 1.95 2000/06/19 15:15:04 lukem Exp $ */
+/* $NetBSD: ftpd.c,v 1.96 2000/06/20 07:39:46 lukem Exp $ */
/*
* Copyright (c) 1997-2000 The NetBSD Foundation, Inc.
@@ -109,7 +109,7 @@ __COPYRIGHT(
#if 0
static char sccsid[] = "@(#)ftpd.c 8.5 (Berkeley) 4/28/95";
#else
-__RCSID("$NetBSD: ftpd.c,v 1.95 2000/06/19 15:15:04 lukem Exp $");
+__RCSID("$NetBSD: ftpd.c,v 1.96 2000/06/20 07:39:46 lukem Exp $");
#endif
#endif /* not lint */
@@ -1448,9 +1448,8 @@ send_data(FILE *instr, FILE *outstr, off_t blksize, int isdata)
}
(void)gettimeofday(&now, NULL);
timersub(&now, &then, &td);
- if (td.tv_sec > 0)
- break;
- usleep(1000000 - td.tv_usec);
+ if (td.tv_sec == 0)
+ usleep(1000000 - td.tv_usec);
}
} else {
while ((c = read(filefd, buf, (size_t)blksize)) > 0) {
@@ -1553,9 +1552,8 @@ receive_data(FILE *instr, FILE *outstr)
}
(void)gettimeofday(&now, NULL);
timersub(&now, &then, &td);
- if (td.tv_sec > 0)
- break;
- usleep(1000000 - td.tv_usec);
+ if (td.tv_sec == 0)
+ usleep(1000000 - td.tv_usec);
}
} else {
while ((c = read(netfd, buf, sizeof(buf))) > 0) {
diff --git a/libexec/ftpd/ftpd.conf.5 b/libexec/ftpd/ftpd.conf.5
index 3eaaae5e918..adf8cdcc0c9 100644
--- a/libexec/ftpd/ftpd.conf.5
+++ b/libexec/ftpd/ftpd.conf.5
@@ -1,4 +1,4 @@
-.\" $NetBSD: ftpd.conf.5,v 1.8 2000/01/12 22:39:29 lukem Exp $
+.\" $NetBSD: ftpd.conf.5,v 1.9 2000/06/20 07:39:48 lukem Exp $
.\"
.\" Copyright (c) 1997-2000 The NetBSD Foundation, Inc.
.\" All rights reserved.
@@ -34,7 +34,7 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.Dd January 11, 2000
+.Dd June 20, 2000
.Dt FTPD.CONF 5
.Os
.Sh NAME
@@ -295,7 +295,8 @@ and both numbers must be be between
Set the maximum get (RETR) transfer rate throttle for
.Ar class
to
-.Ar rate .
+.Ar rate
+bytes per second.
If
.Ar rate
is 0, the throttle is disabled.
@@ -317,7 +318,8 @@ Giga; multiply the argument by 1073741824
Set the maximum put (STOR) transfer rate throttle for
.Ar class
to
-.Ar rate ,
+.Ar rate
+bytes per second,
which is parsed as per
.Sy rateget Ar rate .
.It Sy template Ar class Op Ar refclass