]> arthur.barton.de Git - netatalk.git/commitdiff
Back-port from HEAD: New afpd option: -timeout.
authorsrittau <srittau>
Mon, 14 Jan 2002 02:56:08 +0000 (02:56 +0000)
committersrittau <srittau>
Mon, 14 Jan 2002 02:56:08 +0000 (02:56 +0000)
NEWS
config/afpd.conf.tmpl
etc/afpd/afp_dsi.c
etc/afpd/afp_options.c
etc/afpd/globals.h

diff --git a/NEWS b/NEWS
index 6b189f8557c74b720264772fd41893f8e418dd92..d0f798136f5bf0d52168ebd69cfca3276dc5d8b2 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,7 @@ Changes from 1.5.0
 
 * NEW: Added a program called cnid_didname_verify that can be used to
        verify the consistency of the CNID database.
+* NEW: New afpd option: -timeout. See afpd.conf for more information.
 * UPD: Code cleanups and compatibility fixes to macusers.
 * UPD: AppleVolumes.system was cleaned up.
 * FIX: Really fix Tru64 compilation (see last entry).
index 0f8cadf9d808b003aaf50ab89ac51edba594871a..93065c8e152068dce7be6be0edcb61522cf18f37 100644 (file)
 #     -loginmesg "Message"  Client will display "Message" upon logging in
 #                         (no default, same as -l "Message" on commandline)
 #     -nodebug            Switch off debugging
-#     -tickleval <number> Specify the tickle timeout interval (in seconds)
+#     -tickleval <number> Specify the tickle timeout interval (in seconds).
+#                         Note, this defaults to 30 seconds, and really 
+#                         shouldn't be changed.  If you want to control
+#                         the server idle timeout, use the -timeout option.
+#     -timeout <number>   Specify the number of tickles to send before
+#                         timing out a connection.  The default is 4, therefore
+#                         a connection will timeout in 2 minutes.
 #     -icon               Use the platform-specific icon.
 #              
 # Some examples:
index 64443560227d2872e20a41225f3f8eac3c3ea6d0..bad585f0ab5a24d49c26a92ae0f29d0af5d778b8 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: afp_dsi.c,v 1.9.2.2 2002-01-14 02:53:24 srittau Exp $
+ * $Id: afp_dsi.c,v 1.9.2.3 2002-01-14 02:56:08 srittau Exp $
  *
  * Copyright (c) 1999 Adrian Sun (asun@zoology.washington.edu)
  * Copyright (c) 1990,1993 Regents of The University of Michigan.
@@ -45,7 +45,8 @@ extern struct oforks  *writtenfork;
 
 static struct {
     AFPObj *obj;
-    unsigned char tickle, flags;
+    unsigned char flags;
+    int tickle;
 } child;
 
 
@@ -123,8 +124,8 @@ static void afp_dsi_getmesg (int sig)
 static void alarm_handler()
 {
     /* if we're in the midst of processing something,
-       don't die. we'll allow 3 missed tickles before we die (2 minutes) */
-    if ((child.flags & CHILD_RUNNING) || (child.tickle++ < 4)) {
+       don't die. */
+    if ((child.flags & CHILD_RUNNING) || (child.tickle++ < child.obj->options.timeout)) {
         dsi_tickle(child.obj->handle);
     } else { /* didn't receive a tickle. close connection */
         syslog(LOG_ERR, "afp_alarm: child timed out");
index 5da26aae8bd8f95d253e1a3af93deb73b9607e24..7ba9fe972257b12b9649fd0c79ab6aaa344b17bd 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: afp_options.c,v 1.13.2.1 2001-12-03 05:01:03 jmarcus Exp $
+ * $Id: afp_options.c,v 1.13.2.2 2002-01-14 02:56:08 srittau Exp $
  *
  * Copyright (c) 1997 Adrian Sun (asun@zoology.washington.edu)
  * Copyright (c) 1990,1993 Regents of The University of Michigan.
@@ -141,6 +141,7 @@ void afp_options_init(struct afp_options *options)
     options->transports = AFPTRANS_ALL;
     options->passwdfile = _PATH_AFPDPWFILE;
     options->tickleval = 30;
+    options->timeout = 4;
     options->authprintdir = NULL;
     options->umask = 0;
 #ifdef ADMIN_GRP
@@ -223,8 +224,18 @@ int afp_options_parseline(char *buf, struct afp_options *options)
         options->passwdminlen = MIN(1, atoi(c));
     if ((c = getoption(buf, "-loginmaxfail")))
         options->loginmaxfail = atoi(c);
-    if ((c = getoption(buf, "-tickleval")))
+    if ((c = getoption(buf, "-tickleval"))) {
         options->tickleval = atoi(c);
+               if (options->tickleval <= 0) {
+                       options->tickleval = 30;
+               }
+       }
+    if ((c = getoption(buf, "-timeout"))) {
+           options->timeout = atoi(c);
+                   if (options->timeout <= 0) {
+                           options->timeout = 4;
+                   }
+           }
 
     if ((c = getoption(buf, "-server_quantum")))
         options->server_quantum = strtoul(c, NULL, 0);
index 75fd1ef5ea7ef385fbcdeeb5a56baac96767a4f9..e3be67d28b9132604570f090de6496046a9bc609 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: globals.h,v 1.6.2.1 2001-12-03 05:01:04 jmarcus Exp $
+ * $Id: globals.h,v 1.6.2.2 2002-01-14 02:56:08 srittau Exp $
  *
  * Copyright (c) 1990,1993 Regents of The University of Michigan.
  * All Rights Reserved.  See COPYRIGHT.
@@ -40,7 +40,7 @@
 /* a couple of these options could get stuck in unions to save
  * space. */
 struct afp_options {
-    int connections, port, transports, tickleval, flags;
+    int connections, port, transports, tickleval, timeout, flags;
     unsigned char passwdbits, passwdminlen, loginmaxfail;
     u_int32_t server_quantum;
     char hostname[MAXHOSTNAMELEN + 1], *server, *ipaddr, *configfile;