mirror of
https://github.com/whoahq/whoa.git
synced 2026-11-20 21:14:56 +03:00
feat(net): implement ClientConnection::Disconnect
This commit is contained in:
4 files changed
+44
-2
No files matched your search
@@ -160,8 +160,14 @@ void ClientConnection::Connect() {
|
||||
}
|
||||
|
||||
int32_t ClientConnection::Disconnect() {
|
||||
this->NetClient::Disconnect();
|
||||
|
||||
this->m_connected = 0;
|
||||
|
||||
// TODO
|
||||
return 0;
|
||||
// WardenClient_Destroy();
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
void ClientConnection::GetCharacterList() {
|
||||
|
||||
@@ -165,6 +165,41 @@ void NetClient::DelRef() {
|
||||
}
|
||||
}
|
||||
|
||||
void NetClient::Disconnect() {
|
||||
auto redirectConnection = this->m_redirectConnection;
|
||||
|
||||
if (redirectConnection) {
|
||||
// TODO
|
||||
// redirectConnection->SetResponse(0, 0);
|
||||
|
||||
redirectConnection->Disconnect();
|
||||
redirectConnection->Release();
|
||||
|
||||
this->m_redirectConnection = nullptr;
|
||||
}
|
||||
|
||||
auto serverConnection = this->m_serverConnection;
|
||||
|
||||
if (this->m_netState == NS_CONNECTED) {
|
||||
this->m_netState = NS_DISCONNECTING;
|
||||
|
||||
serverConnection->Disconnect();
|
||||
} else {
|
||||
// TODO
|
||||
// serverConnection->SetResponse(0, 0);
|
||||
|
||||
serverConnection->Disconnect();
|
||||
|
||||
// TODO
|
||||
// this->m_netEventQueue->Clear();
|
||||
|
||||
serverConnection->Release();
|
||||
|
||||
this->m_serverConnection = STORM_NEW(WowConnection)(this, nullptr);
|
||||
this->m_netState = NS_INITIALIZED;
|
||||
}
|
||||
}
|
||||
|
||||
void NetClient::EnableEncryption(WowConnection* conn, uint8_t* seed, uint8_t seedLen) {
|
||||
conn->SetEncryptionKey(
|
||||
this->m_loginData.m_sessionKey,
|
||||
|
||||
@@ -64,6 +64,7 @@ class NetClient : public WowConnectionResponse {
|
||||
void Connect(const char* addrStr);
|
||||
int32_t ConnectInternal(const char* host, uint16_t port);
|
||||
void DelRef();
|
||||
void Disconnect();
|
||||
void EnableEncryption(WowConnection* conn, uint8_t* seed, uint8_t seedLen);
|
||||
bool GetDelete();
|
||||
const LoginData& GetLoginData();
|
||||
|
||||
Reference in new issue
Block a user