avdtp: remove config retry code that uses timer on receive of set config reject message by initiator

This commit is contained in:
Matthias Ringwald 2019-12-17 17:01:11 +01:00
parent 3b74a3bb0f
commit 270f0cfff2
3 changed files with 1 additions and 47 deletions

View File

@ -53,8 +53,6 @@
#include "classic/sdp_client.h"
#include "classic/sdp_util.h"
#define CONFIGURATION_TIMEOUT_MS 300
static int record_id = -1;
static uint8_t attribute_value[1000];
static const unsigned int attribute_value_buffer_size = sizeof(attribute_value);
@ -76,43 +74,6 @@ static uint16_t avdtp_cid_counter = 0;
static void (*handle_media_data)(uint8_t local_seid, uint8_t *packet, uint16_t size);
static void avdtp_handle_sdp_client_query_result(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size);
void avdtp_configuration_timeout_handler(btstack_timer_source_t * timer){
avdtp_connection_t * connection = (avdtp_connection_t *) btstack_run_loop_get_timer_context(timer);
if (!connection){
log_error("Context of avdtp_configuration_timeout_handler is NULL");
return;
}
avdtp_stream_endpoint_t * stream_endpoint = (avdtp_stream_endpoint_t*) connection->active_stream_endpoint;
if (!stream_endpoint) {
log_error("avdtp_configuration_timeout_handler: no initiator stream endpoint for seid %d", connection->initiator_local_seid);
return;
}
if (stream_endpoint->state != AVDTP_STREAM_ENDPOINT_CONFIGURATION_SUBSTATEMACHINE) return;
connection->initiator_transaction_label++;
stream_endpoint->initiator_config_state = AVDTP_INITIATOR_W2_SET_CONFIGURATION;
avdtp_request_can_send_now_initiator(connection, connection->l2cap_signaling_cid);
}
void avdtp_configuration_timer_start(avdtp_connection_t * connection){
avdtp_stream_endpoint_t * stream_endpoint = (avdtp_stream_endpoint_t*) connection->active_stream_endpoint;
if (!stream_endpoint) {
log_error("avdtp_configuration_timer_start: no initiator stream endpoint for seid %d", connection->initiator_local_seid);
return;
}
if (stream_endpoint->state != AVDTP_STREAM_ENDPOINT_CONFIGURATION_SUBSTATEMACHINE){
log_info("avdtp_configuration_timer_start: stream endpoint in wrong state %d, expected %d", stream_endpoint->state, AVDTP_STREAM_ENDPOINT_CONFIGURATION_SUBSTATEMACHINE);
return;
}
log_info("avdtp_configuration_timer_start: start");
btstack_run_loop_remove_timer(&connection->configuration_timer);
btstack_run_loop_set_timer_handler(&connection->configuration_timer, avdtp_configuration_timeout_handler);
btstack_run_loop_set_timer_context(&connection->configuration_timer, connection);
btstack_run_loop_set_timer(&connection->configuration_timer, CONFIGURATION_TIMEOUT_MS);
btstack_run_loop_add_timer(&connection->configuration_timer);
}
void avdtp_configuration_timer_stop(avdtp_connection_t * connection){
btstack_run_loop_remove_timer(&connection->configuration_timer);
}

View File

@ -585,12 +585,7 @@ uint8_t avdtp_choose_sbc_block_length(avdtp_stream_endpoint_t * stream_endpoint,
uint8_t avdtp_choose_sbc_max_bitpool_value(avdtp_stream_endpoint_t * stream_endpoint, uint8_t remote_max_bitpool_value);
uint8_t avdtp_choose_sbc_min_bitpool_value(avdtp_stream_endpoint_t * stream_endpoint, uint8_t remote_min_bitpool_value);
uint8_t avdtp_stream_endpoint_seid(avdtp_stream_endpoint_t * stream_endpoint);
void avdtp_configuration_timeout_handler(btstack_timer_source_t * timer);
void avdtp_configuration_timer_start(avdtp_connection_t * connection);
void avdtp_configuration_timer_stop(avdtp_connection_t * connection);
uint8_t is_avdtp_remote_seid_registered(avdtp_stream_endpoint_t * stream_endpoint);
#if defined __cplusplus

View File

@ -164,7 +164,6 @@ void avdtp_initiator_stream_config_subsm(avdtp_connection_t * connection, uint8_
break;
case AVDTP_SI_SET_CONFIGURATION:{
avdtp_configuration_timer_stop(connection);
if (!stream_endpoint){
log_error("AVDTP_SI_SET_CONFIGURATION: stream endpoint is null");
break;
@ -253,8 +252,7 @@ void avdtp_initiator_stream_config_subsm(avdtp_connection_t * connection, uint8_
switch (connection->initiator_signaling_packet.signal_identifier){
case AVDTP_SI_SET_CONFIGURATION:
connection->configuration_state = AVDTP_CONFIGURATION_STATE_IDLE;
log_info("Received reject for set configuration, role changed from initiator to acceptor. Start timer.");
avdtp_configuration_timer_start(connection);
log_info("Received reject for set configuration, role changed from initiator to acceptor. TODO: implement retry.");
break;
default:
break;