Add logging for unhandled messages

pull/8/head
Nicolas Jouanin 2015-07-11 21:08:03 +02:00
rodzic 06dda7aa8a
commit 4c63b720c4
1 zmienionych plików z 15 dodań i 8 usunięć

Wyświetl plik

@ -18,6 +18,7 @@ from hbmqtt.mqtt.puback import PubackPacket
from hbmqtt.mqtt.pubrec import PubrecPacket from hbmqtt.mqtt.pubrec import PubrecPacket
from hbmqtt.mqtt.pubcomp import PubcompPacket from hbmqtt.mqtt.pubcomp import PubcompPacket
from hbmqtt.mqtt.suback import SubackPacket from hbmqtt.mqtt.suback import SubackPacket
from hbmqtt.mqtt.subscribe import SubscribePacket
from hbmqtt.mqtt.unsuback import UnsubackPacket from hbmqtt.mqtt.unsuback import UnsubackPacket
from hbmqtt.mqtt.disconnect import DisconnectPacket from hbmqtt.mqtt.disconnect import DisconnectPacket
from hbmqtt.session import Session from hbmqtt.session import Session
@ -153,6 +154,8 @@ class ProtocolHandler:
if packet.fixed_header.packet_type == PacketType.CONNACK: if packet.fixed_header.packet_type == PacketType.CONNACK:
asyncio.Task(self.handle_connack(packet)) asyncio.Task(self.handle_connack(packet))
elif packet.fixed_header.packet_type == PacketType.SUBSCRIBE:
asyncio.Task(self.handle_subscribe(packet))
elif packet.fixed_header.packet_type == PacketType.SUBACK: elif packet.fixed_header.packet_type == PacketType.SUBACK:
asyncio.Task(self.handle_suback(packet)) asyncio.Task(self.handle_suback(packet))
elif packet.fixed_header.packet_type == PacketType.UNSUBACK: elif packet.fixed_header.packet_type == PacketType.UNSUBACK:
@ -231,35 +234,39 @@ class ProtocolHandler:
return inflight_message return inflight_message
def handle_keepalive(self): def handle_keepalive(self):
pass self.logger.warn('keepalive unhandled')
@asyncio.coroutine @asyncio.coroutine
def handle_connack(self, connack: ConnackPacket): def handle_connack(self, connack: ConnackPacket):
pass self.logger.warn('CONNACK unhandled')
@asyncio.coroutine @asyncio.coroutine
def handle_connect(self, connect: ConnectPacket): def handle_connect(self, connect: ConnectPacket):
pass self.logger.warn('CONNECT unhandled')
@asyncio.coroutine
def handle_subscribe(self, subscribe: SubscribePacket):
self.logger.warn('SUBSCRIBE unhandled')
@asyncio.coroutine @asyncio.coroutine
def handle_suback(self, suback: SubackPacket): def handle_suback(self, suback: SubackPacket):
pass self.logger.warn('SUBACK unhandled')
@asyncio.coroutine @asyncio.coroutine
def handle_unsuback(self, unsuback: UnsubackPacket): def handle_unsuback(self, unsuback: UnsubackPacket):
pass self.logger.warn('UNSUBACK unhandled')
@asyncio.coroutine @asyncio.coroutine
def handle_pingresp(self, pingresp: PingRespPacket): def handle_pingresp(self, pingresp: PingRespPacket):
pass self.logger.warn('PINGRESP unhandled')
@asyncio.coroutine @asyncio.coroutine
def handle_pingreq(self, pingreq: PingReqPacket): def handle_pingreq(self, pingreq: PingReqPacket):
pass self.logger.warn('PINGREQ unhandled')
@asyncio.coroutine @asyncio.coroutine
def handle_disconnect(self, disconnect: DisconnectPacket): def handle_disconnect(self, disconnect: DisconnectPacket):
pass self.logger.warn('DISCONNECT unhandled')
@asyncio.coroutine @asyncio.coroutine
def handle_puback(self, puback: PubackPacket): def handle_puback(self, puback: PubackPacket):