You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Replace homebrewed smart pointer with std::shared_ptr and std::weak_ptr
Based on commit 8483354 of dumbfixes
branch of 0xFEEDC0DE64 fork of ESPAsyncWebServer.
Buffers to data that is sent to all clients at once are stored as a
single copy of the data with multiple references to it. This usage is
one for which std::shared_ptr should be used. Each client having an
active std::shared_ptr to a master buffer keeps the buffer alive. Once
all clients have finished using their reference, the std::weak_ptr
ensures that the AsyncWebSocketMessageBuffer goes out of scope
and gets invalidated. This invalidation is checked with the lock()
method of the std::weak_ptr.
Also some code formatting while at it.
A future commit will introduce an unification between single-client
buffers and multiple-client buffers in such a way that the master buffer
list in the AsyncWebSocket class will be redundant and will be removed.
Therefore this stage is only temporary.
0 commit comments