mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge.git
synced 2025-01-10 17:11:56 +01:00
Xiaomi SPPv2: Catch exception thrown in onPacketReceived
When a received packet causes an exception to be thrown while getting handled in the service's onPacketReceived method, the message will get stuck in the queue because it is never released. Subsequently received messages get lined up after the first message that causes an exception, and since that message is never removed, those newer messages are never processed. Catching the exception thrown from within the onPacketReceived method allows the code flow to continue and therefore remove the troubling message from the queue.
This commit is contained in:
parent
1d2404a4e6
commit
b5bd4da9b1
@ -105,7 +105,11 @@ public class XiaomiSppProtocolV2 extends AbstractXiaomiSppProtocol {
|
||||
break;
|
||||
case PACKET_TYPE_DATA:
|
||||
XiaomiSppPacketV2.DataPacket dataPacket = (XiaomiSppPacketV2.DataPacket) decodedPacket;
|
||||
support.onPacketReceived(dataPacket.getChannel(), dataPacket.getPayloadBytes(support.getAuthService()));
|
||||
try {
|
||||
support.onPacketReceived(dataPacket.getChannel(), dataPacket.getPayloadBytes(support.getAuthService()));
|
||||
} catch (final Exception ex) {
|
||||
LOG.error("Exception while handling received packet", ex);
|
||||
}
|
||||
// TODO: only directly ack protobuf packets, bulk ack others
|
||||
sendAck(decodedPacket.getSequenceNumber());
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user