]> arthur.barton.de Git - netatalk.git/commitdiff
Add a new -timeout option to afpd. This option specifies how many tickles
authorjmarcus <jmarcus>
Sat, 15 Dec 2001 06:25:43 +0000 (06:25 +0000)
committerjmarcus <jmarcus>
Sat, 15 Dec 2001 06:25:43 +0000 (06:25 +0000)
should be sent before the server closes a AFPoTCP (DSI) session.  The default
is 4 tickles 30 seconds apart, for a timeout of 2 minutes.  This option
should be used instead of -tickleval to control timeouts.

ChangeLog
config/afpd.conf.tmpl
etc/afpd/afp_config.c
etc/afpd/afp_dsi.c
etc/afpd/afp_options.c
etc/afpd/globals.h
etc/afpd/parse_mtab.c

index 7e443fd7b76cc53956a486cad3d6485879b7dc33..30a6b93739da3d42988d4619f27759de30f081c4 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2001-12-14  joe c   <marcus@marcuscom.com>
+       * etc/afpd/afp_options.c, etc/afpd/afp_dsi.c, etc/afpd/globals.h:
+       Add a new option to afpd called -timeout to specify the number of
+       server tickles to send before killing a AFPoTCP session.
+
 2001-12-10  joe c   <marcus@marcuscom.com>
        * bin/cnid/cnid_didname_verify,c: Add a utility to verify the consistency
        of didname.db.  Using the stock db_verify utility will fail as the sort
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 255803360c01a8c51ad7de854fee94fc235cdb4c..de520e5ddd3e4b8d35bd4a1942dff1f9c7a3fe99 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: afp_config.c,v 1.9 2001-12-10 20:16:53 srittau Exp $
+ * $Id: afp_config.c,v 1.10 2001-12-15 06:25:44 jmarcus Exp $
  *
  * Copyright (c) 1997 Adrian Sun (asun@zoology.washington.edu)
  * All Rights Reserved.  See COPYRIGHT.
@@ -173,6 +173,8 @@ static int dsi_start(AFPConfig *config, AFPConfig *configs,
         exit( 1 );
     }
 
+    config->obj.handle = dsi;
+
     /* we've forked. */
     if (dsi->child) {
         configfree(configs, config);
index 6ae44dc6385bfa02245422a4035d51ad4694c46e..c73fa2df1425d7413c77c2b6d8a3465735c6ebe8 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: afp_dsi.c,v 1.11 2001-12-10 20:16:53 srittau Exp $
+ * $Id: afp_dsi.c,v 1.12 2001-12-15 06:25:44 jmarcus 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;
 
 
@@ -70,7 +71,7 @@ static void afp_dsi_die(int sig)
     dsi_attention(child.obj->handle, AFPATTN_SHUTDOWN);
     afp_dsi_close(child.obj);
     if (sig) /* if no signal, assume dieing because logins are disabled &
-        don't log it (maintenance mode)*/
+            don't log it (maintenance mode)*/
         syslog (LOG_INFO, "Connection terminated");
     if (sig == SIGTERM || sig == SIGALRM) {
         exit( 0 );
@@ -124,7 +125,8 @@ 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)) {
+    if ((child.flags & CHILD_RUNNING) || (child.tickle++ < child.obj->options.timeout)) {
+        syslog(LOG_INFO, "afp_dsi: alarm_handler: tickling client...");
         dsi_tickle(child.obj->handle);
     } else { /* didn't receive a tickle. close connection */
         syslog(LOG_ERR, "afp_alarm: child timed out");
index dbba992a3acb2e5c891c753a5fe08c4acb1e4a1d..ab64f79af69b9194f9c1915fa9343131d666b178 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: afp_options.c,v 1.14 2001-12-03 05:03:38 jmarcus Exp $
+ * $Id: afp_options.c,v 1.15 2001-12-15 06:25:44 jmarcus 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 70fffde40c5c70cb504bc6656b548b6e12fa39d4..e67550c72cfbbe5da624f0fef2b0a0eaf658e7b2 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: globals.h,v 1.7 2001-12-03 05:03:38 jmarcus Exp $
+ * $Id: globals.h,v 1.8 2001-12-15 06:25:44 jmarcus 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;
index 6a8920f29c39d1390046e94116ce85c878a746a1..67962cafb88259dff02aae75655a0a0708b50dbc 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: parse_mtab.c,v 1.6 2001-12-10 20:16:54 srittau Exp $
+ * $Id: parse_mtab.c,v 1.7 2001-12-15 06:25:44 jmarcus Exp $
  *
  * afpd_mtab_parse & support.  -- rgr, 9-Apr-01.
  */
@@ -42,7 +42,7 @@ char *strchr (), *strrchr ();
 
 /* global mount table; afpd_st_cnid uses this to lookup the right entry.  */
 static struct afpd_mount_table *afpd_mount_table;
-       
+
 static int
 ceil_log_2 __P((int n))
 /* Return the number of bits required to represent n.  Only works for