/*
- * $Id: afp_dsi.c,v 1.42 2009-10-22 05:09:56 didg Exp $
+ * $Id: afp_dsi.c,v 1.43 2009-10-22 05:53:20 didg Exp $
*
* Copyright (c) 1999 Adrian Sun (asun@zoology.washington.edu)
* Copyright (c) 1990,1993 Regents of The University of Michigan.
#define CHILD_DIE (1 << 0)
#define CHILD_RUNNING (1 << 1)
#define CHILD_SLEEPING (1 << 2)
-#define CHILD_DATA (1 << 3)
static struct {
AFPObj *obj;
#ifdef SERVERTEXT
static void afp_dsi_getmesg (int sig _U_)
{
- readmessage(child.obj);
+ DSI *dsi = (DSI *) child.obj->handle;
+
+ dsi->msg_request = 1;
dsi_attention(child.obj->handle, AFPATTN_MESG | AFPATTN_TIME(5));
}
#endif /* SERVERTEXT */
* may use alarm() */
setitimer(ITIMER_REAL, &dsi->timer, NULL);
- /* we got some traffic from the client since the previous timer
- * tick. */
- if ((child.flags & CHILD_DATA)) {
- child.flags &= ~CHILD_DATA;
- return;
- }
-
/* if we're in the midst of processing something,
don't die. */
if ((child.flags & CHILD_SLEEPING) && child.tickle++ < child.obj->options.sleep) {
}
}
+/* -----------------
+ if dsi->in_write is set attention, tickle (and close?) msg
+ aren't sent. We don't care about tickle
+*/
+static void pending_request(DSI *dsi)
+{
+ /* send pending attention */
+
+ /* read msg if any, it could be done in afp_getsrvrmesg */
+ if (dsi->msg_request) {
+ dsi->msg_request = 0;
+ readmessage(child.obj);
+ }
+}
+
/* -------------------------------------------
afp over dsi. this never returns.
*/
/* timer is not every 30 seconds anymore, so we don't get killed on the client side. */
if ((child.flags & CHILD_DIE))
dsi_tickle(dsi);
+ pending_request(dsi);
continue;
}
- child.flags |= CHILD_DATA;
switch(cmd) {
case DSIFUNC_CLOSE:
afp_dsi_close(obj);
break;
case DSIFUNC_ATTN: /* attention replies */
- continue;
break;
/* error. this usually implies a mismatch of some kind
dsi_writeflush(dsi);
break;
}
+ pending_request(dsi);
}
/* error */