]> arthur.barton.de Git - netatalk.git/blobdiff - libatalk/dsi/dsi_tickle.c
remove the need for blocking SIGALRM (still need to deal with attention volumes changed)
[netatalk.git] / libatalk / dsi / dsi_tickle.c
index fd3ca971dc8f55a9e0faa0b995d93bb45a298843..5b5c7e7b7409c0f097fdba688b6d70f7d68f65ce 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: dsi_tickle.c,v 1.3 2001-06-29 14:14:46 rufustfirefly Exp $
+ * $Id: dsi_tickle.c,v 1.7 2009-10-22 04:59:50 didg Exp $
  *
  * Copyright (c) 1997 Adrian Sun (asun@zoology.washington.edu)
  * All rights reserved. See COPYRIGHT.
 /* 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)
+int dsi_tickle(DSI *dsi)
 {
   char block[DSI_BLOCKSIZ];
   sigset_t oldset;
   u_int16_t id;
+  int ret;
+  
+  if (dsi->asleep || dsi->in_write)
+      return 1;
 
   id = htons(dsi_serverID(dsi));
 
@@ -35,7 +39,8 @@ void dsi_tickle(DSI *dsi)
   /* code = len = reserved = 0 */
 
   sigprocmask(SIG_BLOCK, &dsi->sigblockset, &oldset);
-  dsi_stream_write(dsi, block, DSI_BLOCKSIZ);
+  ret = dsi_stream_write(dsi, block, DSI_BLOCKSIZ, 0) == DSI_BLOCKSIZ;
   sigprocmask(SIG_SETMASK, &oldset, NULL);
+  return ret;
 }