mirror of
https://github.com/XRPLF/clio.git
synced 2025-11-21 12:15:54 +00:00
fix: Data race in new webserver (#1926)
There was a data race inside `CoroutineGroup` because internal timer was used from multiple threads in the methods `asyncWait()` and `onCoroutineComplete()`. Changing `registerForeign()` to spawn to the same `yield_context` fixes the problem because now the timer is accessed only from the same coroutine which has an internal strand. During debugging I also added websocket support for `request_gun` tool.
This commit is contained in:
@@ -73,10 +73,11 @@ public:
|
||||
* @note A foreign coroutine is still counted as a child one, i.e. calling this method increases the size of the
|
||||
* group.
|
||||
*
|
||||
* @param yield The yield context owning the coroutine group.
|
||||
* @return A callback to call on foreign coroutine completes or std::nullopt if the group is already full.
|
||||
*/
|
||||
std::optional<std::function<void()>>
|
||||
registerForeign();
|
||||
registerForeign(boost::asio::yield_context yield);
|
||||
|
||||
/**
|
||||
* @brief Wait for all the coroutines in the group to finish
|
||||
|
||||
Reference in New Issue
Block a user