File tree 2 files changed +2
-7
lines changed
2 files changed +2
-7
lines changed Original file line number Diff line number Diff line change 16
16
#include < vector>
17
17
#include < iostream>
18
18
#include < cstring>
19
+ #include < atomic>
19
20
#include < thread>
20
21
#include < condition_variable>
21
22
#include " utilities.h"
@@ -44,7 +45,7 @@ class RCONPP_EXPORT rcon_client {
44
45
std::thread queue_runner;
45
46
46
47
public:
47
- bool connected{false };
48
+ std::atomic< bool > connected{false };
48
49
49
50
std::function<void (const std::string_view& log)> on_log;
50
51
Original file line number Diff line number Diff line change @@ -241,10 +241,6 @@ void rconpp::rcon_client::start(bool return_after) {
241
241
}
242
242
243
243
for (const queued_request& request : requests_queued) {
244
- // If we're closing the connection down, we need to back out.
245
- if (!connected)
246
- return ;
247
-
248
244
// Send data to callback if it's been set.
249
245
if (request.callback )
250
246
request.callback (send_data_sync (request.data , request.id , request.type ));
@@ -256,8 +252,6 @@ void rconpp::rcon_client::start(bool return_after) {
256
252
}
257
253
});
258
254
259
- queue_runner.detach ();
260
-
261
255
if (!return_after) {
262
256
block_calling_thread ();
263
257
}
You can’t perform that action at this time.
1 commit comments
artemka-sh commentedon Nov 16, 2024
Thank you for this library! I used it in my discord bot to update information about the online game servers of the project