- (char *)otherside,
- &othersize, &client_tuple);
-}
-
-int
-do_listen(service)
-char *service;
-{
- listencon = create_listening_connection(service);
-
- if (listencon == NULL) {
- perror("sms");
- fprintf(stderr,"sms: could not create listening connection\n");
- exit (4);
- }
-
- listenop = create_operation();
-
- othersize = sizeof(otherside);
-
- start_accepting_client(listencon, listenop, &newconn,
- (char *)otherside,
- &othersize, &client_tuple);
-
-}
-
-/*
- * Welcome to the (finite state) machine (highest level).
- */
-do_client(cp)
- client *cp;
-{
- if (OP_STATUS(cp->pending_op) == OP_CANCELLED) {
- fprintf(stderr,"dropping connection..\n");
- reset_operation(cp->pending_op);
- cp->state=CL_DEAD;
- cp->action=0;
- /* XXX should delete client from array */
- return;
- }
- switch (cp->action) {
- case CL_ACCEPT:
- case CL_SEND:
- /* Start recieving next request */
- gdb_inop(cp->pending_op, sms_start_recv, &cp->args, NULL);
- gdb_qop(cp->con, CON_INPUT, cp->pending_op);
- cp->action = CL_RECEIVE;
- break;
- case CL_RECEIVE:
- /* Data is here. Process it & start it heading back */
- do_call(cp); /* This may block for a while. */
- gdb_inop(cp->pending_op, sms_start_send, &cp->reply, NULL);
- gdb_qop(cp->con, CON_OUTPUT, cp->pending_op);
- cp->action = CL_SEND;
- break;
- }
-}
-
-do_call(cl)
- client *cl;
-{
- fprintf(stderr, "Handling call\n");
- /* for now, just echo the stuff back */
- cl->reply=cl->args;