dotnet / dotnet/MQTTnet

Cannot distinguish whether the session expiry interval of a DISCONNECT packet is zero or absent

Open
#1,879 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
C#
Stars
5.1k
Forks
1.2k
PR merge metrics
No merged PRs in 30d

Description

### Describe the bug

The field type of `MqttDisconnectPacket.SessionExpiryInterval` is `uint` instead of `Nullable`, which means we cannot tell whether the session expiry interval is set or zero. According to the [MQTT protocol 5.0 spec](https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901211), the absence and zero-value of the session expiry interval have different meaning.

### To Reproduce
https://github.com/dotnet/MQTTnet/blob/b9683c29436cace6dfa0b00affbe6b5f03e06b5b/Source/MQTTnet/Packets/MqttDisconnectPacket.cs#L30C1-L30C1

### Expected behavior

Use `long` or `uint?` instead of `uint` to represent the field

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.