* 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.
* Avoid creating buffer if pkt larger than ClientNetWriteBufferSize
* Use mempool for Properties Encode
* Use the more efficient Write instead of Write for Buffer to Buffer write
---------
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>
* 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>