Added sync code to client ordered list

This commit is contained in:
Yousef Khadadeh 2025-12-09 13:00:38 +03:00
parent c51b7e7eb1
commit 9649135f43
16 changed files with 233 additions and 143 deletions

View file

@ -177,3 +177,11 @@ void NetClient::send_str_as_bytes(std::shared_ptr<rtc::DataChannel> channel, con
void NetClient::add_recv_callback(MessageCommandType commandID, const NetClientRecvCallback& callback) {
recvCallbacks[commandID] = callback;
}
NetClient::~NetClient() {
if(directConnectServer) {
directConnectServer->directConnectClient = nullptr;
std::erase(directConnectServer->clients, directConnectServer->directConnectClientData);
directConnectServer->directConnectClientData = nullptr;
}
}

View file

@ -32,6 +32,7 @@ class NetClient : public std::enable_shared_from_this<NetClient> {
void add_recv_callback(MessageCommandType commandID, const NetClientRecvCallback& callback);
bool is_disconnected() const;
NetLibrary::DownloadProgress get_progress_into_fragmented_message(const std::string& channel) const;
~NetClient();
private:
std::string localID;

View file

@ -261,6 +261,8 @@ const std::vector<std::shared_ptr<NetServer::ClientData>> NetServer::get_client_
}
NetServer::~NetServer() {
if(directConnectClient)
if(directConnectClient) {
directConnectClient->isDisconnected = true;
directConnectClient->directConnectServer = nullptr;
}
}