kopia lustrzana https://github.com/Yakifo/amqtt
Fix #75.
Reset packet_id when > 65535. This may lead to performance problem when there are still many in-flight messages (QOS1 or QOS 2 not yet acknowledged)pull/8/head
rodzic
d382ada36b
commit
2c1db79127
|
@ -2,13 +2,11 @@
|
|||
#
|
||||
# See the file license.txt for copying permission.
|
||||
import asyncio
|
||||
from transitions import Machine, MachineError
|
||||
from transitions import Machine
|
||||
from asyncio import Queue
|
||||
from collections import OrderedDict
|
||||
from hbmqtt.mqtt.constants import *
|
||||
from hbmqtt.mqtt.publish import PublishPacket
|
||||
from hbmqtt.mqtt.puback import PubackPacket
|
||||
|
||||
from hbmqtt.errors import HBMQTTException
|
||||
|
||||
OUTGOING = 0
|
||||
INCOMING = 1
|
||||
|
@ -132,6 +130,13 @@ class Session:
|
|||
@property
|
||||
def next_packet_id(self):
|
||||
self._packet_id += 1
|
||||
if self._packet_id > 65535:
|
||||
self._packet_id = 1
|
||||
while self._packet_id in self.inflight_in or self._packet_id in self.inflight_out:
|
||||
self._packet_id += 1
|
||||
if self._packet_id > 65535:
|
||||
raise HBMQTTException("More than 65525 messages pending. No free packet ID")
|
||||
|
||||
return self._packet_id
|
||||
|
||||
@property
|
||||
|
|
|
@ -8,9 +8,10 @@ import logging
|
|||
from hbmqtt.client import MQTTClient, ConnectException
|
||||
from hbmqtt.broker import Broker
|
||||
from hbmqtt.mqtt.constants import *
|
||||
from hbmqtt.errors import HBMQTTException
|
||||
|
||||
formatter = "[%(asctime)s] %(name)s {%(filename)s:%(lineno)d} %(levelname)s - %(message)s"
|
||||
logging.basicConfig(level=logging.DEBUG, format=formatter)
|
||||
logging.basicConfig(level=logging.ERROR, format=formatter)
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
broker_config = {
|
||||
|
|
Ładowanie…
Reference in New Issue