]> arthur.barton.de Git - netatalk.git/commitdiff
MFH:
authorjmarcus <jmarcus>
Mon, 11 Feb 2002 17:46:38 +0000 (17:46 +0000)
committerjmarcus <jmarcus>
Mon, 11 Feb 2002 17:46:38 +0000 (17:46 +0000)
Add the -client_polling code.

NEWS
config/afpd.conf.tmpl
doc/CONFIGURE
etc/afpd/afp_options.c
etc/afpd/globals.h
etc/afpd/status.c
etc/afpd/volume.c

diff --git a/NEWS b/NEWS
index 5551e30fcff1eed1847515024380de295a6acf79..9d8320b5cbe7f419666f04b121598387177f6f00 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,9 @@ Changes from 1.5.1
 
 * NEW: NetBSD support contributed by David Rankin and NetBSD contributors.
        This includes a new configure option --enable-netbsd.
+* NEW: Add the -client_polling afpd.conf flag to allow for clients to poll
+       the server every 10 seconds for open window updates.  Currently
+       this is the only way to get asynchronous directory updates.
 * UPD: Use separate macro for AFS configure check.
 * UPD: Some Perl scripts are now (partially) auto-generated. This improves
        out-of-the-box usage of Netatalk.
index 93065c8e152068dce7be6be0edcb61522cf18f37..7b2d0218cebb6772f7e5c925b366dc17aae45545 100644 (file)
 #     -loginmesg "Message"  Client will display "Message" upon logging in
 #                         (no default, same as -l "Message" on commandline)
 #     -nodebug            Switch off debugging
+#     -client_polling     With this switch enabled, afpd won't advertise
+#                         that it is capable of server notifications, so that
+#                         connected clients poll the server every 10 seconds
+#                         to detect changes in opened server windows.
+#                         Note: Depending on the number of simultaneously
+#                         connected clients and the network's speed, this can
+#                         lead to a significant higher load on your network!
 #     -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
index ee014523f8ffc8974621ac0f6eee2b8a42344076..5e8d230cd83c7e989febc531a0a75468b9376dd5 100644 (file)
@@ -112,7 +112,12 @@ Miscellaneous:
                        (no default, same as -l "Message" on
                        command-line)
      -nodebug          Switch off debugging
+     -client_polling   Disable server notifications.  This forces the
+                       clients to poll every 10 seconds for directory updates.  Note, 
+                       currently this is the only way to get asynchronous updates.
      -ticklevel <number>       Specify the tickle timeout interval (in seconds)
+     -timeout <number>         Specify the number of tickles to miss before tearing
+                       down a client connection
      -icon                     Use the platform-specific icon.
 
 An example:
index 0721a810e13c7d81f56c5bd7bca5ecf907923ed8..69e44ddf2da148c8596a40a7afb8903744f1af30 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: afp_options.c,v 1.13.2.5 2002-02-09 05:35:17 jmarcus Exp $
+ * $Id: afp_options.c,v 1.13.2.6 2002-02-11 17:46:40 jmarcus Exp $
  *
  * Copyright (c) 1997 Adrian Sun (asun@zoology.washington.edu)
  * Copyright (c) 1990,1993 Regents of The University of Michigan.
@@ -142,6 +142,7 @@ void afp_options_init(struct afp_options *options)
     options->passwdfile = _PATH_AFPDPWFILE;
     options->tickleval = 30;
     options->timeout = 4;
+    options->server_notif = 1;
     options->authprintdir = NULL;
     options->umask = 0;
 #ifdef ADMIN_GRP
@@ -207,6 +208,8 @@ int afp_options_parseline(char *buf, struct afp_options *options)
         options->transports |= AFPTRANS_DDP;
     if (strstr(buf, " -noddp"))
         options->transports &= ~AFPTRANS_DDP;
+    if (strstr(buf, "-client_polling"))
+        options->server_notif = 0;
 
     /* figure out options w/ values. currently, this will ignore the setting
      * if memory is lacking. */
index 991fc28c16a9e66466c757c768b8f25ffc448f75..5e020f4243c2e8d3247fe46e41de1416f105000f 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: globals.h,v 1.6.2.4 2002-02-09 05:35:17 jmarcus Exp $
+ * $Id: globals.h,v 1.6.2.5 2002-02-11 17:46:40 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, timeout, flags;
+    int connections, port, transports, tickleval, timeout, server_notif, flags;
     unsigned char passwdbits, passwdminlen, loginmaxfail;
     u_int32_t server_quantum;
     char hostname[MAXHOSTNAMELEN + 1], *server, *ipaddr, *configfile;
index 790b8c599037297a984a8a9f2a087a1e3db01942..2cea883772fd69ea47fb1f9daf6828bac701a37b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: status.c,v 1.4.2.4 2002-02-09 05:35:17 jmarcus Exp $
+ * $Id: status.c,v 1.4.2.5 2002-02-11 17:46:40 jmarcus Exp $
  *
  * Copyright (c) 1990,1993 Regents of The University of Michigan.
  * All Rights Reserved.  See COPYRIGHT.
@@ -34,7 +34,7 @@
 #include "afp_config.h"
 #include "icon.h"
 
-static void status_flags(char *data, const int ipok,
+static void status_flags(char *data, const int notif, const int ipok,
                          const unsigned char passwdbits)
 {
     u_int16_t           status;
@@ -49,7 +49,14 @@ static void status_flags(char *data, const int ipok,
     if (ipok)
         status |= AFPSRVRINFO_TCPIP;
     status |= AFPSRVRINFO_SRVMSGS;
-    status |= AFPSRVRINFO_SRVNOTIFY;
+    /* Allow the user to decide if we should support server notifications.
+     * With this turned off, the clients will poll for directory changes every
+     * 10 seconds.  This might be too costly to network resources, so make
+     * this an optional thing.  Default will be to _not_ support server
+     * notifications. */
+    if (notif) {
+        status |= AFPSRVRINFO_SRVNOTIFY;
+    }
     status |= AFPSRVRINFO_FASTBOZO;
     status = htons(status);
     memcpy(data + AFPSTATUS_FLAGOFF, &status, sizeof(status));
@@ -318,7 +325,7 @@ void status_init(AFPConfig *aspconfig, AFPConfig *dsiconfig,
      * (16-bytes), network addresses, volume icon/mask 
      */
 
-    status_flags(status, options->fqdn ||
+    status_flags(status, options->server_notif, options->fqdn ||
                  (dsiconfig && dsi->server.sin_addr.s_addr),
                  options->passwdbits);
     /* returns offset to signature offset */
index 23a34270e02a99466147ef4458d3c630082fe6d4..555028fe8e50e905d63901ca718a6cf99852a9c9 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: volume.c,v 1.14.2.6 2002-02-09 05:35:17 jmarcus Exp $
+ * $Id: volume.c,v 1.14.2.7 2002-02-11 17:46:40 jmarcus Exp $
  *
  * Copyright (c) 1990,1993 Regents of The University of Michigan.
  * All Rights Reserved.  See COPYRIGHT.
@@ -1308,7 +1308,9 @@ struct vol        *vol;
     /* a little granularity */
     if (vol->v_time < tv.tv_sec) {
         vol->v_time = tv.tv_sec;
-        obj->attention(obj->handle, AFPATTN_NOTIFY | AFPATTN_VOLCHANGED);
+        if (obj->options.server_notif) {
+            obj->attention(obj->handle, AFPATTN_NOTIFY | AFPATTN_VOLCHANGED);
+        }
     }
 }