server state machine