michael@0: ========================================================================= michael@0: State machine transitions for the Crash Generation Server michael@0: ========================================================================= michael@0: michael@0: ========================================================================= michael@0: | michael@0: STATE | ACTIONS michael@0: | michael@0: ========================================================================= michael@0: ERROR | Clean up resources used to serve clients. michael@0: | Always remain in ERROR state. michael@0: ------------------------------------------------------------------------- michael@0: INITIAL | Connect to the pipe asynchronously. michael@0: | If connection is successfully queued up asynchronously, michael@0: | go into CONNECTING state. michael@0: | If connection is done synchronously, go into CONNECTED michael@0: | state. michael@0: | For any unexpected problems, go into ERROR state. michael@0: ------------------------------------------------------------------------- michael@0: CONNECTING | Get the result of async connection request. michael@0: | If I/O is still incomplete, remain in the CONNECTING michael@0: | state. michael@0: | If connection is complete, go into CONNECTED state. michael@0: | For any unexpected problems, go into DISCONNECTING state. michael@0: ------------------------------------------------------------------------- michael@0: CONNECTED | Read from the pipe asynchronously. michael@0: | If read request is successfully queued up asynchronously, michael@0: | go into READING state. michael@0: | For any unexpected problems, go into DISCONNECTING state. michael@0: ------------------------------------------------------------------------- michael@0: READING | Get the result of async read request. michael@0: | If read is done, go into READ_DONE state. michael@0: | For any unexpected problems, go into DISCONNECTING state. michael@0: ------------------------------------------------------------------------- michael@0: READ_DONE | Register the client, prepare the reply and write the michael@0: | reply to the pipe asynchronously. michael@0: | If write request is successfully queued up asynchronously, michael@0: | go into WRITING state. michael@0: | For any unexpected problems, go into DISCONNECTING state. michael@0: ------------------------------------------------------------------------- michael@0: WRITING | Get the result of the async write request. michael@0: | If write is done, go into WRITE_DONE state. michael@0: | For any unexpected problems, go into DISCONNECTING state. michael@0: ------------------------------------------------------------------------- michael@0: WRITE_DONE | Read from the pipe asynchronously (for an ACK). michael@0: | If read request is successfully queued up asynchonously, michael@0: | go into READING_ACK state. michael@0: | For any unexpected problems, go into DISCONNECTING state. michael@0: ------------------------------------------------------------------------- michael@0: READING_ACK | Get the result of the async read request. michael@0: | If read is done, perform action for successful client michael@0: | connection. michael@0: | Go into DISCONNECTING state. michael@0: ------------------------------------------------------------------------- michael@0: DISCONNECTING | Disconnect from the pipe, reset the event and go into michael@0: | INITIAL state and signal the event again. If anything michael@0: | fails, go into ERROR state. michael@0: =========================================================================