Addressing some bugs regarding lifetimes and callbacks that could trigger random-ish crashed - wip
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
#include <columnlynx/common/utils.hpp>
|
||||
#include <columnlynx/common/libsodium_wrapper.hpp>
|
||||
#include <array>
|
||||
#include <atomic>
|
||||
#include <algorithm>
|
||||
#include <vector>
|
||||
#include <unordered_map>
|
||||
@@ -89,8 +90,8 @@ namespace ColumnLynx::Net::TCP {
|
||||
|
||||
// TODO: Move ptrs to smart ptrs
|
||||
|
||||
bool mConnected = false;
|
||||
bool mHandshakeComplete = false;
|
||||
std::atomic<bool> mConnected{false};
|
||||
std::atomic<bool> mHandshakeComplete{false};
|
||||
tcp::resolver mResolver;
|
||||
tcp::socket mSocket;
|
||||
std::shared_ptr<MessageHandler> mHandler;
|
||||
|
||||
@@ -39,6 +39,6 @@ namespace ColumnLynx::Net::TCP {
|
||||
std::array<uint8_t, 3> mHeader{}; // [type][lenHigh][lenLow]
|
||||
std::vector<uint8_t> mBody;
|
||||
std::function<void(AnyMessageType, std::string)> mOnMessage;
|
||||
std::function<void(asio::error_code&)> mOnDisconnect;
|
||||
std::function<void(const asio::error_code&)> mOnDisconnect;
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user