]> arthur.barton.de Git - netatalk.git/commitdiff
Add the -server_notif server flag to specify whether or not to advertise
authorjmarcus <jmarcus>
Wed, 6 Feb 2002 21:58:47 +0000 (21:58 +0000)
committerjmarcus <jmarcus>
Wed, 6 Feb 2002 21:58:47 +0000 (21:58 +0000)
server notification support.  If this flag is not specified, then the clients
will poll the server every 10 seconds for directory changes.

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

index 1f36ada25921323bce0a6a12cf7674770ffc9819..f92e858e361d23b8265f863c41dbb72beced85b8 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2002-02-06  joe c  <marcus@marcuscom.com>
+       * etc/afpd/globals.h, etc/afpd/afp_options.c, etc/afpd/status.c
+       etc/afpd/volume.c: Add a new option -server_notif to specify that
+       a server supports server notifications.  If this flag is not specified
+       the client will poll the server every 10 seconds for directory changes.
+
 2002-02-03  and m  <morgan@orst.edu>
        * bin/afppasswd/Makefile.am
        Added an install-exec-hook to make the afppasswd binary suid root
index 375cfdf83b866cd87c73c9f4b5175adc2c6c4287..26535e4301086b15f4720301d69e0c4a7ad04511 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: afp_options.c,v 1.17 2002-01-19 21:29:55 jmarcus Exp $
+ * $Id: afp_options.c,v 1.18 2002-02-06 21:58:50 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 e67550c72cfbbe5da624f0fef2b0a0eaf658e7b2..a60232f1a5d34091286d948ddf1a4292503c9f0e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: globals.h,v 1.8 2001-12-15 06:25:44 jmarcus Exp $
+ * $Id: globals.h,v 1.9 2002-02-06 21:58:50 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 07ef932bc1f74561db887e8531342e4a7242a514..f5acacaeb4c59245199c57b58048c4f05d278ca3 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: status.c,v 1.6 2001-12-10 20:16:54 srittau Exp $
+ * $Id: status.c,v 1.7 2002-02-06 21:58:50 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 82d52ffc0250f809ad5d8c2927e77fd2fb639ba3..09b9841eb141d7a35b4b7dfe778166aa4b3602db 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: volume.c,v 1.21 2002-01-19 21:29:55 jmarcus Exp $
+ * $Id: volume.c,v 1.22 2002-02-06 21:58:50 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);
+        }
     }
 }