* use cl.id instead of pk.Connect.ClientIdentifier which is client-supplied, when looking for existing clients in inheritClientSession
* look for assigned client id explicitly
* simpler implementation using just cl.ID
---------
Co-authored-by: JB <28275108+mochi-co@users.noreply.github.com>
* Added client.StopTime() to expose `disconnected`
* Added a test of Client.StopTime()
I added a check to TestClientStop(), both before and after stopping.
I also noticed a race condition in the test (comparing a time against
time.Now) and fixed it to allow a one-second discrepancy.
* 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>