]> arthur.barton.de Git - netatalk.git/blobdiff - libatalk/dsi/dsi_tickle.c
Spotlight: new options for controlling query behaviour
[netatalk.git] / libatalk / dsi / dsi_tickle.c
index c0ba655853888d1030aa1eeaa010512b5e16608a..a283d40b82670fbb1b3172788fca1e8bfa62a248 100644 (file)
@@ -1,24 +1,29 @@
 /*
+ *
  * Copyright (c) 1997 Adrian Sun (asun@zoology.washington.edu)
  * All rights reserved. See COPYRIGHT.
  */
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif /* HAVE_CONFIG_H */
+
 #include <stdio.h>
 #include <sys/types.h>
 #include <string.h>
 #include <signal.h>
 
 #include <atalk/dsi.h>
-#include <netatalk/endian.h>
 
 /* server generated tickles. as this is only called by the tickle handler,
- * we don't need to block signals. well, actually, we might get it during
- * a SIGHUP. */
-void dsi_tickle(DSI *dsi)
+ * we don't need to block signals. */
+int dsi_tickle(DSI *dsi)
 {
   char block[DSI_BLOCKSIZ];
-  sigset_t oldset;
-  u_int16_t id;
+  uint16_t id;
+  
+  if ((dsi->flags & DSI_SLEEPING) || dsi->in_write)
+      return 1;
 
   id = htons(dsi_serverID(dsi));
 
@@ -28,8 +33,6 @@ void dsi_tickle(DSI *dsi)
   memcpy(block + 2, &id, sizeof(id));
   /* code = len = reserved = 0 */
 
-  sigprocmask(SIG_BLOCK, &dsi->sigblockset, &oldset);
-  dsi_stream_write(dsi, block, DSI_BLOCKSIZ);
-  sigprocmask(SIG_SETMASK, &oldset, NULL);
+  return dsi_stream_write(dsi, block, DSI_BLOCKSIZ, DSI_NOWAIT);
 }