]> arthur.barton.de Git - netatalk.git/blobdiff - libatalk/dsi/dsi_attn.c
1) try a better workaround for deadlocks when both the server and the client are...
[netatalk.git] / libatalk / dsi / dsi_attn.c
index 395ee1db940e73063a80819e05168438569ca0d8..8a9eaddedaac355cf484fc997ead9973da3311b8 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: dsi_attn.c,v 1.7 2009-10-22 04:59:50 didg Exp $
+ * $Id: dsi_attn.c,v 1.8 2009-10-25 06:13:11 didg Exp $
  *
  * Copyright (c) 1997 Adrian Sun (asun@zoology.washington.edu)
  * All rights reserved. See COPYRIGHT.
@@ -31,13 +31,15 @@ int dsi_attention(DSI *dsi, AFPUserBytes flags)
 {
   /* header + AFPUserBytes */
   char block[DSI_BLOCKSIZ + sizeof(AFPUserBytes)];
-  sigset_t oldset;
   u_int32_t len, nlen;
   u_int16_t id;
 
-  if (dsi->asleep || dsi->in_write)
+  if (dsi->asleep)
       return 1;
-      
+
+  if (dsi->in_write) {
+      return -1;
+  }      
   id = htons(dsi_serverID(dsi));
   flags = htons(flags);
   len = MIN(sizeof(flags), dsi->attn_quantum);
@@ -53,9 +55,5 @@ int dsi_attention(DSI *dsi, AFPUserBytes flags)
   /* reserved = 0 */
 
   /* send an attention */
-  sigprocmask(SIG_BLOCK, &dsi->sigblockset, &oldset);
-  len = dsi_stream_write(dsi, block, DSI_BLOCKSIZ + len, 0);
-  sigprocmask(SIG_SETMASK, &oldset, NULL);
-
-  return len;
+  return dsi_stream_write(dsi, block, DSI_BLOCKSIZ + len, DSI_NOWAIT);
 }