]> arthur.barton.de Git - netatalk.git/commitdiff
MFH:
authorjmarcus <jmarcus>
Fri, 8 Feb 2002 02:54:24 +0000 (02:54 +0000)
committerjmarcus <jmarcus>
Fri, 8 Feb 2002 02:54:24 +0000 (02:54 +0000)
afp_options.c 1.18
globals.h 1.9
status.c 1.7
volume.c 1.22

Add the -server_notif server flag to specify whether or not to advertise
server notification support.  If this flag is not specified, then the clients
will poll the server every 10 seconds for directory changes.

etc/afpd/afp_options.c
etc/afpd/globals.h
etc/afpd/status.c
etc/afpd/volume.c

index 6f19df50d78f8030c78ee5c0002905a4380f3f60..b86c9b7af5d4ecc190abfbc85a38da1f91100d3a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: afp_options.c,v 1.13.2.3 2002-02-07 23:54:27 srittau Exp $
+ * $Id: afp_options.c,v 1.13.2.4 2002-02-08 02:54:24 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 = 0;
     options->authprintdir = NULL;
     options->umask = 0;
 #ifdef ADMIN_GRP
@@ -236,6 +237,9 @@ int afp_options_parseline(char *buf, struct afp_options *options)
             options->timeout = 4;
         }
     }
+    if ((c = getoption(buf, "-server_notif"))) {
+        options->server_notif = 1;
+    }
 
     if ((c = getoption(buf, "-server_quantum")))
         options->server_quantum = strtoul(c, NULL, 0);
index e3be67d28b9132604570f090de6496046a9bc609..3fb45b3db174c27ce12c3ab5d381b95bd4f92b25 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: globals.h,v 1.6.2.2 2002-01-14 02:56:08 srittau Exp $
+ * $Id: globals.h,v 1.6.2.3 2002-02-08 02:54:24 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 3019d34bd782d9da5d7306fe6f53c75ba766cc25..291989d65647429fa459de09fa2191fe157691a7 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: status.c,v 1.4.2.2 2002-01-02 17:27:50 srittau Exp $
+ * $Id: status.c,v 1.4.2.3 2002-02-08 02:54:24 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 52f7eeb8e63ecfef67a587c913f65789aa204e85..ff3fe170676d3d5f1a97cb2eae62690d2b562dd5 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: volume.c,v 1.14.2.4 2002-02-07 23:57:54 srittau Exp $
+ * $Id: volume.c,v 1.14.2.5 2002-02-08 02:54:24 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);
+        }
     }
 }