/*
- * $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.
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);
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;
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 *));
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));
/*
- * $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));
/* 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;
}