]> arthur.barton.de Git - netatalk.git/commitdiff
MFH: child would not die if connection broke in dsi_tickle
authorbfernhomberg <bfernhomberg>
Tue, 18 Nov 2003 21:47:41 +0000 (21:47 +0000)
committerbfernhomberg <bfernhomberg>
Tue, 18 Nov 2003 21:47:41 +0000 (21:47 +0000)
etc/afpd/afp_dsi.c
include/atalk/dsi.h
libatalk/dsi/dsi_tickle.c

index 23a2c604f1f622e16227e18b0cac88f3abc7a44e..4bdd7a2e4aad3d23f9c98fb34c8470d65aa301c6 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: afp_dsi.c,v 1.24.2.3 2003-11-05 06:41:01 didg Exp $
+ * $Id: afp_dsi.c,v 1.24.2.4 2003-11-18 21:47:41 bfernhomberg Exp $
  *
  * Copyright (c) 1999 Adrian Sun (asun@zoology.washington.edu)
  * Copyright (c) 1990,1993 Regents of The University of Michigan.
@@ -130,10 +130,16 @@ static void afp_dsi_getmesg (int sig)
 
 static void alarm_handler()
 {
+    int err;
+
     /* if we're in the midst of processing something,
        don't die. */
     if ((child.flags & CHILD_RUNNING) || (child.tickle++ < child.obj->options.timeout)) {
-        dsi_tickle(child.obj->handle);
+        if (!(err = pollvoltime(child.obj)))
+            err = dsi_tickle(child.obj->handle);
+        if (err <= 0) 
+            afp_dsi_die(1);
+        
     } else { /* didn't receive a tickle. close connection */
         LOG(log_error, logtype_afpd, "afp_alarm: child timed out");
         afp_dsi_die(1);
index 80d08dbc79ca605996e079ce5892a3d589ebc6da..be587c64156ec233c43622f5fe74dc591a7cd52c 100644 (file)
@@ -62,8 +62,7 @@ typedef struct DSI {
   u_int32_t attn_quantum, datasize, server_quantum;
   u_int16_t serverID, clientID;
   u_int8_t *status, commands[DSI_CMDSIZ], data[DSI_DATASIZ];
-  int statuslen;
-  unsigned int datalen, cmdlen;
+  int statuslen, datalen, cmdlen;
   size_t read_count, write_count;
   /* inited = initialized?, child = a child?, noreply = send reply? */
   char child, inited, noreply;
@@ -135,7 +134,7 @@ extern void dsi_kill __P((int));
 extern void dsi_opensession __P((DSI *));
 extern int  dsi_attention __P((DSI *, AFPUserBytes));
 extern int  dsi_cmdreply __P((DSI *, const int));
-extern void dsi_tickle __P((DSI *));
+extern int  dsi_tickle __P((DSI *));
 extern void dsi_getstatus __P((DSI *));
 extern void dsi_close __P((DSI *));
 
@@ -143,7 +142,7 @@ extern void dsi_close __P((DSI *));
 extern size_t dsi_stream_write __P((DSI *, void *, const size_t));
 extern size_t dsi_stream_read __P((DSI *, void *, const size_t));
 extern int dsi_stream_send __P((DSI *, void *, size_t));
-extern int dsi_stream_receive __P((DSI *, void *, const size_t, size_t *));
+extern int dsi_stream_receive __P((DSI *, void *, const int, int *));
 
 /* client writes -- dsi_write.c */
 extern size_t dsi_writeinit __P((DSI *, void *, const size_t));
index fd3ca971dc8f55a9e0faa0b995d93bb45a298843..cce3da191a6f1e5c85f97a6250540dca7b81e8e5 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.3.8.1 2003-11-18 21:47:41 bfernhomberg 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;
+  
   id = htons(dsi_serverID(dsi));
 
   memset(block, 0, sizeof(block));
@@ -35,7 +36,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) == DSI_BLOCKSIZ;
   sigprocmask(SIG_SETMASK, &oldset, NULL);
+  return ret;
 }