fix use of max mtu for att server

This commit is contained in:
matthias.ringwald@gmail.com 2014-11-18 12:56:07 +00:00
parent 4d7288b3ec
commit eb37a75f1d
3 changed files with 6 additions and 3 deletions

View File

@ -292,10 +292,11 @@ static uint16_t handle_exchange_mtu_request(att_connection_t * att_connection, u
uint16_t client_rx_mtu = READ_BT_16(request_buffer, 1);
if (client_rx_mtu < att_connection->mtu){
// find min(local max mtu, remote mtu) and use as mtu for this connection
if (client_rx_mtu < att_connection->max_mtu){
att_connection->mtu = client_rx_mtu;
} else {
att_connection->mtu = att_connection->mtu;
att_connection->mtu = att_connection->max_mtu;
}
response_buffer[0] = ATT_EXCHANGE_MTU_RESPONSE;

View File

@ -155,6 +155,7 @@ extern "C" {
typedef struct att_connection {
uint16_t con_handle;
uint16_t mtu;
uint16_t max_mtu;
uint8_t encryption_key_size;
uint8_t authenticated;
uint8_t authorized;

View File

@ -126,7 +126,8 @@ static void att_event_packet_handler (uint8_t packet_type, uint16_t channel, uin
bt_flip_addr(att_client_address, &packet[8]);
// reset connection properties
att_connection.con_handle = READ_BT_16(packet, 4);
att_connection.mtu = l2cap_max_mtu();
att_connectino.mtu = ATT_DEFAULT_MTU;
att_connection.max_mtu = l2cap_max_le_mtu();
att_connection.encryption_key_size = 0;
att_connection.authenticated = 0;
att_connection.authorized = 0;