implement l2cap timeout check for HAVE_TIME_MS

This commit is contained in:
Matthias Ringwald 2015-12-23 16:41:44 +01:00
parent 7cdb8a02d8
commit 5f26aadcab
2 changed files with 14 additions and 2 deletions

View File

@ -207,6 +207,12 @@ static void hci_connection_timeout_handler(timer_source_t *timer){
// connections might be timed out
hci_emit_l2cap_check_timeout(connection);
}
#endif
#ifdef HAVE_TIME_MS
if (run_loop_get_time_ms() > connection->timestamp + HCI_CONNECTION_TIMEOUT_MS){
// connections might be timed out
hci_emit_l2cap_check_timeout(connection);
}
#endif
run_loop_set_timer(timer, HCI_CONNECTION_TIMEOUT_MS);
run_loop_add_timer(timer);
@ -219,6 +225,9 @@ static void hci_connection_timestamp(hci_connection_t *connection){
#ifdef HAVE_TICK
connection->timestamp = embedded_get_ticks();
#endif
#ifdef HAVE_TIME_MS
connection->timestamp = run_loop_get_time_ms();
#endif
}

View File

@ -386,9 +386,12 @@ typedef struct {
struct timeval timestamp;
#endif
#ifdef HAVE_TICK
uint32_t timestamp; // timeout in system ticks
uint32_t timestamp; // timestamp in system ticks
#endif
#ifdef HAVE_TIME_MS
uint32_t timestamp; // timestamp in ms
#endif
// ACL packet recombination - PRE_BUFFER + ACL Header + ACL payload
uint8_t acl_recombination_buffer[HCI_INCOMING_PRE_BUFFER_SIZE + 4 + HCI_ACL_BUFFER_SIZE];
uint16_t acl_recombination_pos;