mirror of
https://github.com/whoahq/whoa.git
synced 2026-02-01 00:02:45 +03:00
feat(net): implement ClientConnection::Disconnect
This commit is contained in:
parent
700db49edc
commit
ad8cf56d29
@ -1103,7 +1103,7 @@ enum NETSTATE {
|
||||
NS_UNINITIALIZED = 0,
|
||||
NS_INITIALIZING = 1,
|
||||
NS_INITIALIZED = 2,
|
||||
NS_STATE_3 = 3,
|
||||
NS_DISCONNECTING = 3,
|
||||
NS_CONNECTING = 4,
|
||||
NS_CONNECTED = 5,
|
||||
};
|
||||
|
||||
@ -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();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user