rfcomm: finalize multiplexer on l2cap disconnect in any state

This commit is contained in:
Matthias Ringwald 2016-05-25 11:45:46 +02:00
parent a16832cfee
commit 7d20d6a437

View File

@ -1027,19 +1027,8 @@ static int rfcomm_hci_event_handler(uint8_t *packet, uint16_t size){
log_info("L2CAP_EVENT_CHANNEL_CLOSED cid 0x%0x, mult %p", l2cap_cid, multiplexer);
if (!multiplexer) break;
log_info("L2CAP_EVENT_CHANNEL_CLOSED state %u", multiplexer->state);
switch (multiplexer->state) {
case RFCOMM_MULTIPLEXER_W4_CONNECT:
case RFCOMM_MULTIPLEXER_SEND_SABM_0:
case RFCOMM_MULTIPLEXER_W4_SABM_0:
case RFCOMM_MULTIPLEXER_SEND_UA_0:
case RFCOMM_MULTIPLEXER_W4_UA_0:
case RFCOMM_MULTIPLEXER_OPEN:
// don't call l2cap_disconnect as it's alreay closed
rfcomm_multiplexer_finalize(multiplexer);
return 1;
default:
break;
}
// no need to call l2cap_disconnect here, as it's already closed
rfcomm_multiplexer_finalize(multiplexer);
break;
default:
break;