* Moving go cl.WriteLoop() out of NewClient() and placing it in server.attachClient().
* Call cl.Stop() to cancel the context, update cl.State with information such as disconnected time, and set the stopCause.
* update README-CN.md
---------
Co-authored-by: JB <28275108+mochi-co@users.noreply.github.com>
* fix when no max msg expiry interval is set
* fix expiry handling of clearExpiredInflights
* Modify it to handle cases where the MaximumMessageExpiryInterval is set to 0 or math.MaxInt64 for no expiry, and optimize some of the code and test cases.
* Set MaximumMessageExpiryInterval to 0 or math.MaxInt64 for no expiration, and optimize some of the code and test cases.
* Addressing the issue of numeric overflow with expiration values.
* Only when server.Options.Capabilities.MaximumMessageExpiryInterval is set to math.MaxInt64 for no expiry.
* fix typo in README.md
* There is no need to verify whether 'maximumExpiry' is 'math.MaxInt64' within 'client.ClearInflight()
* Optimize the code to make it easier to understand.
* Differentiate the handling of 'expire' in MQTTv5 and MQTTv3; skip expiration checks if MaximumMessageExpiryInterval is set to 0; optimize code and test cases.
* When MaximumMessageExpiryInterval is set to 0, it should not affect the message's own expiration(for v5) evaluation.
* Adding client.ClearExpiredInflights() to clear expired messages, while client.ClearInflights() is used to clear all inflight messages.
---------
Co-authored-by: JB <28275108+mochi-co@users.noreply.github.com>
Co-authored-by: werben <werben@aliyun.com>
Co-authored-by: werben <werben@qq.com>
* Ensure msg doesn't exceed subscription QoS
* Disconnect or return ack if unauthorized publish
* Disconnect or return ack if unauthorized publish
* Create new server for eery test case
---------
Co-authored-by: JB <28275108+mochi-co@users.noreply.github.com>
* Another code implementation for Inline Client Subscriptions.
* Added a few test cases.
* Changed the return value types of Server.Unsubscribe() and Subscribe() to boolean.
* Implementing the delivery of retained messages and supporting multiple callbacks per topic using different inline client IDs.
* Added validation checks for the legality of the inline client id during Subscribe and Unsubscribe.
* Added validation checks for the legality of the client during Subscribe and Unsubscribe.
* Fixed the TestServerSubscribe/invalid_client_id test case failure.
* Add Server.inlineClient and Temporarily removing test cases for better code review readability.
* Using server.inlineClient in server.InjectPacket().
* After unsubscribing, if there are other subscriptions in particle.inlineSubscriptions, particle cannot be deleted.
* Add comments to particle.inlineSubscriptions and modify to return ErrTopicFilterInvalid when the topic is invalid during subscription.
* Fixed some test case failures caused by adding inlineClient to the server.
* More test cases have been added.
* Optimization of test case code.
* Modify server.go: When used as a publisher, treat the qos of inline client-published messages as 0.
* Resolve conflict.
* Begin adding new slog calls
* Fixed unit tests
* Add leveler example
* Add debug log level to Redis example
* Change location of server.Close() and add logs to example/hooks
* Begin removing references to zerolog
* Removed final references to zerolog
* Change where server.Close() occurs in main
* Change to 1.21 to remove x dependency
* Add slog
* Update references to 1.21
* Begin change of LogAttrs to standard logging interface
* Change the rest of LogAttrs to default
* Fix bad log
* Update badger.go
Changing "data" to "key" or "id" here might be more appropriate.
* Update badger.go
Changing "data" to "key" or "id" here might be more appropriate.
* Update server.go
Not checking if err is equal to nil
* Update server.go
printing information for ID or error is missing.
* Change references of err.Error() to err in slog
* Remove missed removal of Error() references for logging
---------
Co-authored-by: Derek Duncan <dduncan@atlassian.com>
Co-authored-by: Derek Duncan <derekduncan@gmail.com>
Co-authored-by: JB <28275108+mochi-co@users.noreply.github.com>
Co-authored-by: werbenhu <werben@qq.com>
* Add retainMessage to LWT to properly handle message retention if specified in connect
* Add will retain flag on missed test
---------
Co-authored-by: Derek Duncan <derekduncan@gmail.com>
If SessionExpiryInterval was not set in CONNECT, SessionExpiryIntervalFlag is also not set. According to spec:
If the Session Expiry Interval is absent the value 0 is used. If it is set to 0, or is absent, the Session ends when the Network Connection is closed.
Simplify the code for the loadInflight and loadRetained methods.
Adjust the validation order of the processSubscribe method to ensure that it fails quickly if there is an error, since s.hooks. OnACLCheck generally takes a long time.
Co-authored-by: JB <28275108+mochi-co@users.noreply.github.com>