* Let the reader beware.
*
* $Log$
- * Revision 1.10 1987-06-30 20:02:26 wesommer
- * Added returned tuple chain to client structure.
- * Added local realm global variable.
+ * Revision 1.11 1987-07-29 16:04:54 wesommer
+ * Add keepalive feature.
*
+ * Revision 1.10 87/06/30 20:02:26 wesommer
+ * Added returned tuple chain to client structure.
+ * Added local realm global variable.
+ *
* Revision 1.9 87/06/21 16:39:54 wesommer
* Performance work, rearrangement of include files.
*
void oplist_append();
extern u_short ntohs();
+extern time_t now;
+
/*
* Main SMS server loop.
*
char **argv;
{
int status;
+ time_t tardy;
whoami = argv[0];
/*
continue;
}
if (takedown) break;
+ time(&now);
#ifdef notdef
fprintf(stderr, " tick\n");
#endif notdef
/*
* Handle any existing connections.
*/
+ tardy = now - 30*60;
+
for (i=0; i<nclients; i++) {
+ cur_client = clients[i];
if (OP_DONE(clients[i]->pending_op)) {
- cur_client = clients[i];
+ cur_client->last_time_used = now;
do_client(cur_client);
- cur_client = NULL;
- if (takedown) break;
+ } else if (clients[i]->last_time_used < tardy) {
+ com_err(whoami, 0, "Shutting down connection due to inactivity");
+ shutdown(cur_client->con->in.fd, 0);
}
+ cur_client = NULL;
+ if (takedown) break;
}
/*
* Handle any new connections.
cp->reply.sms_argv = NULL;
cp->first = NULL;
cp->last = NULL;
-
+ cp->last_time_used = now;
newconn = NULL;
cp->pending_op = create_operation();