25개 이상의 토픽을 선택하실 수 없습니다.
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
- namespace MQTTnet.Client
- {
- public class MqttPacketIdentifierProvider
- {
- private readonly object _syncRoot = new object();
- private ushort _value;
-
- public void Reset()
- {
- lock (_syncRoot)
- {
- _value = 0;
- }
- }
-
- public ushort GetNewPacketIdentifier()
- {
- lock (_syncRoot)
- {
- _value++;
-
- if (_value == 0)
- {
- // As per official MQTT documentation the package identifier should never be 0.
- _value = 1;
- }
-
- return _value;
- }
- }
- }
- }
|