When a publish, subscribe or unsubscribe request was cancelled or
timed out client-side, the corresponding awaitable was removed from
the packet dispatcher. A subsequent PUBACK / PUBCOMP / SUBACK /
UNSUBACK arriving from the broker then fell through to the default
case and raised an MqttProtocolViolationException, which forced a
disconnect. Under high publish load (issue #2079) and from multiple
threads (issue #2078) this manifested as sporadic connection drops.
Match these acknowledgement packets explicitly and log a warning
when no awaiter is registered, instead of treating it as a protocol
violation. The connection is now preserved.
Also documents the thread-safety guarantees of IMqttClient: publish,
subscribe, unsubscribe and ping operations are safe to invoke
concurrently. Connect / disconnect must still be coordinated.
Co-authored-by: meisa <meisa@MAFDEL>
Co-authored-by: christian <6939810+chkr1011@users.noreply.github.com>
* Add support for binary user properties in MQTT 5.0
* Optimize byte array reversal in SubscriptionTopicHashTests
* Use InvariantCulture for topic string conversion in Load_Tests
* switched to `Microsoft.Testing.Platform`
* Refactor CI workflow to separate signed and unsigned package builds
* Add condition to sign job to prevent execution on external pull requests
* Remove fallback to value as string in MqttUserProperty
* Refactor MqttUserProperty handling to use byte arrays for improved performance and add deprecation warnings for legacy methods
* Add Directory.Build.props.
* Adjust Analysis related properties and add conditional enablement for ContinuousIntegrationBuild.
* Adopt new changes in master
---------
Co-authored-by: christian <6939810+chkr1011@users.noreply.github.com>
* Make use of language features line AsyncDispose, init etc.
* Fix build errors
* Improve Unit Tests
* Improve Unit Tests
* Improve Unit Tests
* Update samples
* Remove obsolete benchmarks
* Code cleanup
* Improve unit tests
* Improve Unit Tests
* Fix Unit Tests
* Improve Unit Tests
* Improve Unit Tests
* Restore unit tests
* Exclude load tests from unit tests
* Improve session message injection methods
* Add more tests for session injection
* Change return type from MqttPublishPacket to MqttPacketWithIdentifier
* Use dedicated type for MattApplicationMessage injection result
* Code review minor fixes
* Apply project code style
* Update release notes
---------
Co-authored-by: Anton Smolkov <anton.smolkov@idp.zyfra.com>
Co-authored-by: christian <6939810+chkr1011@users.noreply.github.com>
* Implement enhanced authentication for client and server.
* Update samples
* Add abstraction layer
* Merge master
* Use dedicated class for public API.
* Update release notes
* Rename methods to fit naming scheme
* Fix unit tests and samples
* Topic templates: Ensure parameter values are checked for wildcard
* Topic templates: Complement extension methods
- add template.BuildMessage()
- add subscribeOptionsBuilder.WithTopicTemplate()
* Topic templates: switch some samples to use a topic template
The changes should be self-explanatory and are
intended to provide more examples.
* Topic templates: add README
* Add support for changing the protocol type on socket level
* Do not set NoDelay when not supported by protocol
* Update release notes
* Fix release notes
* fix: time out and cancel propagation in managed client
* Update release notes
* Refactor code
---------
Co-authored-by: christian <6939810+chkr1011@users.noreply.github.com>
* Add MqttTopicTemplate
The topic template class is a way to deal with dynamic topics that
is less cumbersome and error-prone than String.Format or
other string fu one might use to handle dynamic topics.
Example:
MyCity/{street}/{crossing}/lights
'street' and 'crossing' would be parameters.
The class and its extension methods are intended to support
dynamic subscription/publication, message-topic matching and
routing. The template syntax is modelled after the well-known
moustache syntax, which conincidentally is also published
as the 'AsyncAPI channel address expressions'.
* Add MQTTnet.Extensions.TopicTemplate to solution
* Apply code style from team shared resharper settings.
Add missing file headers.
* Update release notes
---------
Co-authored-by: christian <6939810+chkr1011@users.noreply.github.com>
* Access exception so that it will not treated as unhandled
* Refactor code
* Improve unit tests
* Fix null reference exception
* Update ReleaseNotes.md
* Update settings for tests project so that it will build on linux
* Improve unit tests and samples
* Remove no longer required target frameworks for unit tests
* Update ci.yml
* Add possibility to specify parameter to RPC invocation which will be accessible in TopicGenerationContext.
* Make parameters optional
* Update ReleaseNotes.md
---------
Co-authored-by: Christian <6939810+chkr1011@users.noreply.github.com>
* Refactor Unit Tests
* Add new certificate provider interface instead of read only certificates list.
* Update ReleaseNotes.md
* Fix Unit Tests
* Fix build
* unit testing hot swappable certificates (#1787)
* Move test classes to correct namespace
* Apply code style
---------
Co-authored-by: Sean Hanna <hannasm@users.noreply.github.com>
* Moved check on Options.ValidateFeatures below ThrowIf methods to prevent NullReferenceException
* Add Unit Test
* Update ReleaseNotes.md
---------
Co-authored-by: Christian <6939810+chkr1011@users.noreply.github.com>
* Return task with NULL result instead of NULL
* move Task.FromResult call out of lock
* Update ReleaseNotes.md
---------
Co-authored-by: Christian <6939810+chkr1011@users.noreply.github.com>