X-Git-Url: http://andersk.mit.edu/gitweb/moira.git/blobdiff_plain/d26cae4e8caafd3f2b0632da67fc4ec3f151bfd7..7f024a70fc6eead45e256e1454c9a6edd4d8c6ec:/server/mr_main.c diff --git a/server/mr_main.c b/server/mr_main.c index 7f78cf61..5aa41a20 100644 --- a/server/mr_main.c +++ b/server/mr_main.c @@ -14,9 +14,12 @@ * Let the reader beware. * * $Log$ - * Revision 1.7 1987-06-08 02:44:44 wesommer - * Minor lint fix. + * Revision 1.8 1987-06-09 18:44:45 wesommer + * modified error handling. * + * Revision 1.7 87/06/08 02:44:44 wesommer + * Minor lint fix. + * * Revision 1.6 87/06/03 17:41:00 wesommer * Added startup support. * @@ -108,7 +111,9 @@ main(argc, argv) com_err(whoami, 0, "GDB initialization failed."); exit(1); } - + gdb_debug(0); /* this can be patched, if necessary, to enable */ + /* GDB level debugging .. */ + /* * Database initialization. */ @@ -192,7 +197,11 @@ main(argc, argv) * Handle any new connections. */ if (OP_DONE(listenop)) { - if ((status = new_connection()) != 0) { + if (OP_STATUS(listenop) == OP_CANCELLED) { + com_err(whoami, errno, "Error on listen"); + exit(1); + + } else if ((status = new_connection()) != 0) { com_err(whoami, errno, "Error on listening operation."); /* @@ -237,7 +246,7 @@ do_listen() int new_connection() { - register client *cp = (client *)malloc(sizeof *cp); + register client *cp; static counter = 0; /* @@ -254,7 +263,7 @@ new_connection() /* * Set up the new connection and reply to the client */ - + cp = (client *)malloc(sizeof *cp); cp->state = CL_STARTING; cp->action = CL_ACCEPT; cp->con = newconn; @@ -354,6 +363,7 @@ clist_delete(cp) reset_operation(cp->pending_op); delete_operation(cp->pending_op); + sever_connection(cp->con); free((char *)cp); }