rework error exits path to simplify if statement
This commit is contained in:
parent
e92c257ac4
commit
f85928e0b0
@ -119,16 +119,19 @@ void wtp_send_configure(void)
|
|||||||
capwap_packet_txmng_free(txmngpacket);
|
capwap_packet_txmng_free(txmngpacket);
|
||||||
|
|
||||||
/* Send Configuration Status request to AC */
|
/* Send Configuration Status request to AC */
|
||||||
if (capwap_crypt_sendto_fragmentpacket(&g_wtp.dtls, g_wtp.requestfragmentpacket)) {
|
if (!capwap_crypt_sendto_fragmentpacket(&g_wtp.dtls, g_wtp.requestfragmentpacket)) {
|
||||||
g_wtp.retransmitcount = 0;
|
|
||||||
wtp_dfa_change_state(CAPWAP_CONFIGURE_STATE);
|
|
||||||
capwap_timeout_set(g_wtp.timeout, g_wtp.idtimercontrol, WTP_RETRANSMIT_INTERVAL, wtp_dfa_retransmition_timeout, NULL, NULL);
|
|
||||||
} else {
|
|
||||||
/* Error to send packets */
|
/* Error to send packets */
|
||||||
capwap_logging_debug("Warning: error to send configuration status request packet");
|
capwap_logging_debug("Warning: error to send configuration status request packet");
|
||||||
wtp_free_reference_last_request();
|
wtp_free_reference_last_request();
|
||||||
wtp_teardown_connection();
|
wtp_teardown_connection();
|
||||||
|
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g_wtp.retransmitcount = 0;
|
||||||
|
wtp_dfa_change_state(CAPWAP_CONFIGURE_STATE);
|
||||||
|
capwap_timeout_set(g_wtp.timeout, g_wtp.idtimercontrol, WTP_RETRANSMIT_INTERVAL,
|
||||||
|
wtp_dfa_retransmition_timeout, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* */
|
/* */
|
||||||
|
@ -34,16 +34,19 @@ void wtp_send_datacheck(void)
|
|||||||
capwap_packet_txmng_free(txmngpacket);
|
capwap_packet_txmng_free(txmngpacket);
|
||||||
|
|
||||||
/* Send Change State Event request to AC */
|
/* Send Change State Event request to AC */
|
||||||
if (capwap_crypt_sendto_fragmentpacket(&g_wtp.dtls, g_wtp.requestfragmentpacket)) {
|
if (!capwap_crypt_sendto_fragmentpacket(&g_wtp.dtls, g_wtp.requestfragmentpacket)) {
|
||||||
g_wtp.retransmitcount = 0;
|
|
||||||
wtp_dfa_change_state(CAPWAP_DATA_CHECK_STATE);
|
|
||||||
capwap_timeout_set(g_wtp.timeout, g_wtp.idtimercontrol, WTP_RETRANSMIT_INTERVAL, wtp_dfa_retransmition_timeout, NULL, NULL);
|
|
||||||
} else {
|
|
||||||
/* Error to send packets */
|
/* Error to send packets */
|
||||||
capwap_logging_debug("Warning: error to send change state event request packet");
|
capwap_logging_debug("Warning: error to send change state event request packet");
|
||||||
wtp_free_reference_last_request();
|
wtp_free_reference_last_request();
|
||||||
wtp_teardown_connection();
|
wtp_teardown_connection();
|
||||||
|
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g_wtp.retransmitcount = 0;
|
||||||
|
wtp_dfa_change_state(CAPWAP_DATA_CHECK_STATE);
|
||||||
|
capwap_timeout_set(g_wtp.timeout, g_wtp.idtimercontrol, WTP_RETRANSMIT_INTERVAL,
|
||||||
|
wtp_dfa_retransmition_timeout, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* */
|
/* */
|
||||||
|
@ -77,16 +77,19 @@ void wtp_send_join(void)
|
|||||||
capwap_packet_txmng_free(txmngpacket);
|
capwap_packet_txmng_free(txmngpacket);
|
||||||
|
|
||||||
/* Send join request to AC */
|
/* Send join request to AC */
|
||||||
if (capwap_crypt_sendto_fragmentpacket(&g_wtp.dtls, g_wtp.requestfragmentpacket)) {
|
if (!capwap_crypt_sendto_fragmentpacket(&g_wtp.dtls, g_wtp.requestfragmentpacket)) {
|
||||||
g_wtp.retransmitcount = 0;
|
|
||||||
wtp_dfa_change_state(CAPWAP_JOIN_STATE);
|
|
||||||
capwap_timeout_set(g_wtp.timeout, g_wtp.idtimercontrol, WTP_RETRANSMIT_INTERVAL, wtp_dfa_retransmition_timeout, NULL, NULL);
|
|
||||||
} else {
|
|
||||||
/* Error to send packets */
|
/* Error to send packets */
|
||||||
capwap_logging_debug("Warning: error to send join request packet");
|
capwap_logging_debug("Warning: error to send join request packet");
|
||||||
wtp_free_reference_last_request();
|
wtp_free_reference_last_request();
|
||||||
wtp_teardown_connection();
|
wtp_teardown_connection();
|
||||||
|
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g_wtp.retransmitcount = 0;
|
||||||
|
wtp_dfa_change_state(CAPWAP_JOIN_STATE);
|
||||||
|
capwap_timeout_set(g_wtp.timeout, g_wtp.idtimercontrol, WTP_RETRANSMIT_INTERVAL,
|
||||||
|
wtp_dfa_retransmition_timeout, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* */
|
/* */
|
||||||
|
@ -30,15 +30,15 @@ static int send_echo_request(void)
|
|||||||
capwap_packet_txmng_free(txmngpacket);
|
capwap_packet_txmng_free(txmngpacket);
|
||||||
|
|
||||||
/* Send echo request to AC */
|
/* Send echo request to AC */
|
||||||
if (capwap_crypt_sendto_fragmentpacket(&g_wtp.dtls, g_wtp.requestfragmentpacket)) {
|
if (!capwap_crypt_sendto_fragmentpacket(&g_wtp.dtls, g_wtp.requestfragmentpacket)) {
|
||||||
result = 0;
|
|
||||||
} else {
|
|
||||||
/* Error to send packets */
|
/* Error to send packets */
|
||||||
capwap_logging_debug("Warning: error to send echo request packet");
|
capwap_logging_debug("Warning: error to send echo request packet");
|
||||||
wtp_free_reference_last_request();
|
wtp_free_reference_last_request();
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* */
|
/* */
|
||||||
@ -218,13 +218,15 @@ void wtp_dfa_state_run_echo_timeout(struct capwap_timeout* timeout, unsigned lon
|
|||||||
void* context, void* param)
|
void* context, void* param)
|
||||||
{
|
{
|
||||||
capwap_logging_debug("Send Echo Request");
|
capwap_logging_debug("Send Echo Request");
|
||||||
if (!send_echo_request()) {
|
if (send_echo_request()) {
|
||||||
g_wtp.retransmitcount = 0;
|
|
||||||
capwap_timeout_set(g_wtp.timeout, g_wtp.idtimercontrol, WTP_RETRANSMIT_INTERVAL, wtp_dfa_retransmition_timeout, NULL, NULL);
|
|
||||||
} else {
|
|
||||||
capwap_logging_error("Unable to send Echo Request");
|
capwap_logging_error("Unable to send Echo Request");
|
||||||
wtp_teardown_connection();
|
wtp_teardown_connection();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g_wtp.retransmitcount = 0;
|
||||||
|
capwap_timeout_set(g_wtp.timeout, g_wtp.idtimercontrol, WTP_RETRANSMIT_INTERVAL,
|
||||||
|
wtp_dfa_retransmition_timeout, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* */
|
/* */
|
||||||
|
Loading…
Reference in New Issue
Block a user