mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-03-14 01:27:41 +00:00
linked_list: stop using linked lit item context in hci, sm,bnep, and rfcomm
This commit is contained in:
parent
596d62218e
commit
91a977e85b
@ -311,7 +311,7 @@ static void sm_truncate_key(sm_key_t key, int max_encryption_size){
|
||||
|
||||
static void sm_timeout_handler(btstack_timer_source_t * timer){
|
||||
log_info("SM timeout");
|
||||
sm_connection_t * sm_conn = (sm_connection_t *) btstack_linked_item_get_user((btstack_linked_item_t*) timer);
|
||||
sm_connection_t * sm_conn = btstack_run_loop_get_timer_context(timer);
|
||||
sm_conn->sm_engine_state = SM_GENERAL_TIMEOUT;
|
||||
sm_done_for_handle(sm_conn->sm_handle);
|
||||
|
||||
@ -320,9 +320,9 @@ static void sm_timeout_handler(btstack_timer_source_t * timer){
|
||||
}
|
||||
static void sm_timeout_start(sm_connection_t * sm_conn){
|
||||
btstack_run_loop_remove_timer(&setup->sm_timeout);
|
||||
btstack_run_loop_set_timer_context(&setup->sm_timeout, sm_conn);
|
||||
btstack_run_loop_set_timer_handler(&setup->sm_timeout, sm_timeout_handler);
|
||||
btstack_run_loop_set_timer(&setup->sm_timeout, 30000); // 30 seconds sm timeout
|
||||
btstack_linked_item_set_user((btstack_linked_item_t*) &setup->sm_timeout, sm_conn);
|
||||
btstack_run_loop_add_timer(&setup->sm_timeout);
|
||||
}
|
||||
static void sm_timeout_stop(void){
|
||||
|
@ -612,7 +612,7 @@ int bnep_set_multicast_filter(uint16_t bnep_cid, bnep_multi_filter_t *filter, u
|
||||
/* BNEP timeout timer helper function */
|
||||
static void bnep_channel_timer_handler(btstack_timer_source_t *timer)
|
||||
{
|
||||
bnep_channel_t *channel = (bnep_channel_t *)btstack_linked_item_get_user((btstack_linked_item_t *) timer);
|
||||
bnep_channel_t *channel = btstack_run_loop_get_timer_context(timer);
|
||||
// retry send setup connection at least one time
|
||||
if (channel->state == BNEP_CHANNEL_STATE_WAIT_FOR_CONNECTION_RESPONSE){
|
||||
if (channel->retry_count < BNEP_CONNECTION_MAX_RETRIES){
|
||||
@ -645,8 +645,8 @@ static void bnep_channel_start_timer(bnep_channel_t *channel, int timeout)
|
||||
|
||||
/* Start bnep channel timeout check timer */
|
||||
btstack_run_loop_set_timer(&channel->timer, timeout);
|
||||
channel->timer.process = bnep_channel_timer_handler;
|
||||
btstack_linked_item_set_user((btstack_linked_item_t*) &channel->timer, channel);
|
||||
btstack_run_loop_set_timer_handler(&channel->timer, bnep_channel_timer_handler);
|
||||
btstack_run_loop_set_timer_context(&channel->timer, channel);
|
||||
btstack_run_loop_add_timer(&channel->timer);
|
||||
channel->timer_active = 1;
|
||||
}
|
||||
|
@ -715,7 +715,7 @@ static void rfcomm_multiplexer_finalize(rfcomm_multiplexer_t * multiplexer){
|
||||
}
|
||||
|
||||
static void rfcomm_multiplexer_timer_handler(btstack_timer_source_t *timer){
|
||||
rfcomm_multiplexer_t * multiplexer = (rfcomm_multiplexer_t *) btstack_linked_item_get_user( (btstack_linked_item_t *) timer);
|
||||
rfcomm_multiplexer_t * multiplexer = btstack_run_loop_get_timer_context(timer);
|
||||
if (rfcomm_multiplexer_has_channels(multiplexer)) return;
|
||||
|
||||
log_info("rfcomm_multiplexer_timer_handler timeout: shutting down multiplexer! (no channels)");
|
||||
@ -733,8 +733,8 @@ static void rfcomm_multiplexer_prepare_idle_timer(rfcomm_multiplexer_t * multipl
|
||||
|
||||
// start idle timer for multiplexer timeout check as there are no rfcomm channels yet
|
||||
btstack_run_loop_set_timer(&multiplexer->timer, RFCOMM_MULIPLEXER_TIMEOUT_MS);
|
||||
multiplexer->timer.process = rfcomm_multiplexer_timer_handler;
|
||||
btstack_linked_item_set_user((btstack_linked_item_t*) &multiplexer->timer, multiplexer);
|
||||
btstack_run_loop_set_timer_handler(&multiplexer->timer, rfcomm_multiplexer_timer_handler);
|
||||
btstack_run_loop_set_timer_context(&multiplexer->timer, multiplexer);
|
||||
btstack_run_loop_add_timer(&multiplexer->timer);
|
||||
multiplexer->timer_active = 1;
|
||||
}
|
||||
|
@ -112,8 +112,8 @@ static hci_connection_t * create_connection_for_bd_addr_and_type(bd_addr_t addr,
|
||||
conn->authentication_flags = AUTH_FLAGS_NONE;
|
||||
conn->bonding_flags = 0;
|
||||
conn->requested_security_level = LEVEL_0;
|
||||
btstack_linked_item_set_user(&conn->timeout.item, conn);
|
||||
conn->timeout.process = hci_connection_timeout_handler;
|
||||
btstack_run_loop_set_timer_handler(&conn->timeout, hci_connection_timeout_handler);
|
||||
btstack_run_loop_set_timer_context(&conn->timeout, conn);
|
||||
hci_connection_timestamp(conn);
|
||||
conn->acl_recombination_length = 0;
|
||||
conn->acl_recombination_pos = 0;
|
||||
@ -188,7 +188,7 @@ hci_connection_t * hci_connection_for_bd_addr_and_type(bd_addr_t addr, bd_addr_
|
||||
}
|
||||
|
||||
static void hci_connection_timeout_handler(btstack_timer_source_t *timer){
|
||||
hci_connection_t * connection = (hci_connection_t *) btstack_linked_item_get_user(&timer->item);
|
||||
hci_connection_t * connection = (hci_connection_t *) btstack_run_loop_get_timer_context(timer);
|
||||
#ifdef HAVE_TIME
|
||||
struct timeval tv;
|
||||
gettimeofday(&tv, NULL);
|
||||
|
Loading…
x
Reference in New Issue
Block a user