References: <20200715141600.26610-1-arne@...1227...> From: Arne Schwabe Message-ID: Date: Wed, 15 Jul 2020 19:40:28 +0200 MIME-Version: 1.0 In-Reply-To: Content-Language: en-GB Subject: Re: [Openvpn-devel] [PATCH v6 8/14] client-connect: Add CC_RET_DEFERRED and cope with deferred client-connect List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit To: Antonio Quartulli , openvpn-devel@lists.sourceforge.net Am 15.07.2020 um 16:59 schrieb Antonio Quartulli: > Hi, > > On 15/07/2020 16:16, Arne Schwabe wrote: > [CUT] > >> - multi_client_connect_early_setup(m, mi); >> + handler = &client_connect_handlers[defer_state->cur_handler_index]; >> >> - for (int i = 0; cc_succeeded && handlers[i]; i++) >> + while (cc_succeeded && handler->main != NULL) >> { >> - ret = handlers[i](m, mi, &option_types_found); >> - cc_succeeded = cc_check_return(&cc_succeeded_count, ret); >> + enum client_connect_return ret; >> + if (from_deferred) >> + { >> + ret = handler->deferred(m, mi, &(defer_state->option_types_found)); >> + from_deferred = false; >> + } >> + else >> + { >> + ret = handler->main(m, mi, &(defer_state->option_types_found)); >> + } >> + >> + if (ret == CC_RET_SUCCEEDED) >> + { >> + /* >> + * Remember that we already had at least one handler >> + * returning a result should go to into deferred state >> + */ >> + mi->context.c2.context_auth = CAS_PENDING_DEFERRED_PARTIAL; >> + } >> + else if (ret == CC_RET_SKIPPED) >> + { >> + /* >> + * Move on with the next handler without modifying any >> + * other state >> + */ >> + } >> + else if (ret == CC_RET_DEFERRED) >> + { >> + /* >> + * we already set client_connect_status to DEFERRED_RESULT or >> + * DEFERRED_NO_RESULT and increased index. We just return >> + * from the function as having client_connect_status >> + */ >> + return; >> + } >> + else if (ret == CC_RET_FAILED) >> + { >> + /* >> + * One handler failed. We abort the chain and set the final >> + * result to failed >> + */ >> + cc_succeeded = false; >> + } >> + else >> + { >> + ASSERT(0); >> + } >> + >> + handler = &client_connect_handlers[defer_state->cur_handler_index]; >> + (defer_state->cur_handler_index)++; > shouldn't these 2 lines above be inverted? > (these parenthesis....) Yeah :( Arne