Refactoring libboostasio (part 6)#566
Open
paolopas wants to merge 28 commits intoCopernicaMarketingSoftware:masterfrom
Open
Refactoring libboostasio (part 6)#566paolopas wants to merge 28 commits intoCopernicaMarketingSoftware:masterfrom
paolopas wants to merge 28 commits intoCopernicaMarketingSoftware:masterfrom
Conversation
replaces get_dispatch_wrapper, switched from boost:: to std::bind and std::function
…re#464) appended LibBoostAsioHandler ctor parameter (with default value) uint16_t connection_timeout = 60
slow down the heartbeat emission if the client has already sent data within the negotiated timeout, a similar improvement was suggested for LivEvHandler in CopernicaMarketingSoftware#550
race condition due to *_pending flags no more possible, updated footnote with important information for handler's user
final notes updated
called by destructor to prevent deadlocks, relaxed assert in monitor to allow early realeses, final notes update
method events renamed to set_event_mask
to the parent and no longer need the managed pointers for the strand
predictable watcher death, smarter make_callback method
that no longer have to handle boost errors
reference, simplified constructor
This was referenced Dec 23, 2025
as rw handlers have to be cancelled before any change in _read/_write flag may occur This reverts commit 060348c.
Author
|
#547 fixed |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note
This is the sixth and last child, the code is branched from #562 (fifth child), so this one accumulate the changes.
Each commit has been checked for regressions.
Watcherno longer have to inherit fromenable_shared_from_this, but more importantly, themake_handleravoids creating another pair of weak/shared ptr to guardthis(which previously was done at every callback invocation, i.e. every time the socket becomes readable or writable, even just to receive 1 byte!) Butmake_handleris now smarter for another reason too: in case of errors from boost it exits immediately without calling the callback at all. As I already explained, this, together with the cancellation of the callbacks by the destructor, allows you not to have to worry too much about the dangling of thethis. Finally, the handler now stores children usingunique_ptrsinstead ofshared_ptrs. Simple pointers could have been used, but I preferred to stay aligned with the other handlers. Now, when you erase the child in the map, the object is certainly destroyed. There are no delays of any kind, and no need to be careful to avoid releasing sockets too late. In short, everything works as expected, with no surprises. This is the greatest benefit for anyone who reads or maintains the code. This and a certain amount of appropriate comments added where needed.strand, after all they don't ask much else from their parent.As usual, for the more impatient among you, I'm leaving this latest version below. If the one that existed before I started working on it was in production, well, then this one can go to Mars.
Important
libboostasio_2025-12-23.zip