From 19314b6686a8ac3702881addf9dec35263916c12 Mon Sep 17 00:00:00 2001 From: Aleric Inglewood Date: Sat, 23 Feb 2013 21:25:27 +0100 Subject: [PATCH] Removed two unnecessary states from AICurlEasyRequestStateMachine Removed AICurlEasyRequestStateMachine_added and AICurlEasyRequestStateMachine_finished because the state machine is not taking any action there anyway, and those states might be skipped all together even, so they make no sense / shouldn't exist. --- .../aicurleasyrequeststatemachine.cpp | 39 ++++--------------- 1 file changed, 8 insertions(+), 31 deletions(-) diff --git a/indra/llmessage/aicurleasyrequeststatemachine.cpp b/indra/llmessage/aicurleasyrequeststatemachine.cpp index b9f486d67..9a95ceb5f 100644 --- a/indra/llmessage/aicurleasyrequeststatemachine.cpp +++ b/indra/llmessage/aicurleasyrequeststatemachine.cpp @@ -36,10 +36,8 @@ enum curleasyrequeststatemachine_state_type { AICurlEasyRequestStateMachine_addRequest = AIStateMachine::max_state, AICurlEasyRequestStateMachine_waitAdded, - AICurlEasyRequestStateMachine_added, - AICurlEasyRequestStateMachine_timedOut, // This must be smaller than the rest, so they always overrule. - AICurlEasyRequestStateMachine_finished, - AICurlEasyRequestStateMachine_removed, // The removed states must be largest two, so they are never ignored. + AICurlEasyRequestStateMachine_timedOut, // This must be smaller than the rest, so they always overrule. + AICurlEasyRequestStateMachine_removed, // The removed states must be largest two, so they are never ignored. AICurlEasyRequestStateMachine_removed_after_finished, AICurlEasyRequestStateMachine_bad_file_descriptor }; @@ -50,9 +48,7 @@ char const* AICurlEasyRequestStateMachine::state_str_impl(state_type run_state) { AI_CASE_RETURN(AICurlEasyRequestStateMachine_addRequest); AI_CASE_RETURN(AICurlEasyRequestStateMachine_waitAdded); - AI_CASE_RETURN(AICurlEasyRequestStateMachine_added); AI_CASE_RETURN(AICurlEasyRequestStateMachine_timedOut); - AI_CASE_RETURN(AICurlEasyRequestStateMachine_finished); AI_CASE_RETURN(AICurlEasyRequestStateMachine_removed); AI_CASE_RETURN(AICurlEasyRequestStateMachine_removed_after_finished); AI_CASE_RETURN(AICurlEasyRequestStateMachine_bad_file_descriptor); @@ -77,14 +73,12 @@ void AICurlEasyRequestStateMachine::initialize_impl(void) // CURL-THREAD void AICurlEasyRequestStateMachine::added_to_multi_handle(AICurlEasyRequest_wat&) { - set_state(AICurlEasyRequestStateMachine_added); } // CURL-THREAD void AICurlEasyRequestStateMachine::finished(AICurlEasyRequest_wat&) { mFinished = true; - set_state(AICurlEasyRequestStateMachine_finished); } // CURL-THREAD @@ -130,15 +124,11 @@ void AICurlEasyRequestStateMachine::multiplex_impl(void) // immediately after this call. mAdded = true; mCurlEasyRequest.addRequest(); // This causes the state to be changed, now or later, to - // AICurlEasyRequestStateMachine_added, then - // AICurlEasyRequestStateMachine_finished and then // AICurlEasyRequestStateMachine_removed_after_finished. - // The first two states might be skipped thus, and the state at this point is one of + // The state at this point is thus one of // 1) AICurlEasyRequestStateMachine_waitAdded (idle) - // 2) AICurlEasyRequestStateMachine_added (running) - // 3) AICurlEasyRequestStateMachine_finished (running) - // 4) AICurlEasyRequestStateMachine_removed_after_finished (running) + // 2) AICurlEasyRequestStateMachine_removed_after_finished (running) if (mTotalDelayTimeout > 0.f) { @@ -151,22 +141,16 @@ void AICurlEasyRequestStateMachine::multiplex_impl(void) } break; } - case AICurlEasyRequestStateMachine_added: + case AICurlEasyRequestStateMachine_waitAdded: { - // The request was added to the multi handle. This is a no-op, which is good cause - // this state might be skipped anyway ;). - idle(current_state); // Wait for the next event. - - // The state at this point is one of - // 1) AICurlEasyRequestStateMachine_added (idle) - // 2) AICurlEasyRequestStateMachine_finished (running) - // 3) AICurlEasyRequestStateMachine_removed_after_finished (running) + // Nothing to do. + idle(AICurlEasyRequestStateMachine_waitAdded); break; } case AICurlEasyRequestStateMachine_timedOut: { // It is possible that exactly at this point the state changes into - // AICurlEasyRequestStateMachine_finished, with as result that mTimedOut + // AICurlEasyRequestStateMachine_removed_after_finished, with as result that mTimedOut // is set while we will continue with that state. Hence that mTimedOut // is explicitly reset in that state. @@ -179,7 +163,6 @@ void AICurlEasyRequestStateMachine::multiplex_impl(void) idle(current_state); // Wait till AICurlEasyRequestStateMachine::removed_from_multi_handle() is called. break; } - case AICurlEasyRequestStateMachine_finished: case AICurlEasyRequestStateMachine_removed_after_finished: { if (!mHandled) @@ -199,12 +182,6 @@ void AICurlEasyRequestStateMachine::multiplex_impl(void) easy_request_w->processOutput(); } - if (current_state == AICurlEasyRequestStateMachine_finished) - { - idle(current_state); // Wait till AICurlEasyRequestStateMachine::removed_from_multi_handle() is called. - break; - } - // See above. mTimedOut = false; /* Fall-Through */