feat(net): handle connection removal in WowConnectionNet

This commit is contained in:
fallenoak 2023-02-18 17:16:41 -06:00 committed by GitHub
parent 84a4ead425
commit 0ca1c8e331
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 19 additions and 1 deletions

View File

@ -35,7 +35,15 @@ void WowConnectionNet::Delete(WowConnection* connection) {
}
void WowConnectionNet::Remove(WowConnection* connection) {
// TODO
this->m_connectionsLock.Enter();
if (this->m_connections.IsLinked(connection)) {
this->m_connections.UnlinkNode(connection);
}
this->PlatformRemove(connection);
this->m_connectionsLock.Leave();
}
void WowConnectionNet::Run() {

View File

@ -42,6 +42,7 @@ class WowConnectionNet {
void PlatformAdd(WowConnection* connection);
void PlatformChangeState(WowConnection* connection, WOW_CONN_STATE state);
void PlatformInit(bool useEngine);
void PlatformRemove(WowConnection* connection);
void PlatformRun();
void PlatformWorkerReady();
void Remove(WowConnection* connection);

View File

@ -31,6 +31,11 @@ void WowConnectionNet::PlatformInit(bool useEngine) {
// TODO
}
void WowConnectionNet::PlatformRemove(WowConnection* connection) {
char buf = '\1';
write(s_workerPipe[1], &buf, sizeof(buf));
}
void WowConnectionNet::PlatformRun() {
pipe(s_workerPipe);

View File

@ -14,6 +14,10 @@ void WowConnectionNet::PlatformInit(bool useEngine) {
// TODO
}
void WowConnectionNet::PlatformRemove(WowConnection* connection) {
// TODO
}
void WowConnectionNet::PlatformRun() {
// TODO
}