Fixed ProtoProxy compilation, added client Kick handling.
This commit is contained in:
parent
6ea7c2b772
commit
ebc076e8b2
@ -201,6 +201,9 @@ enum
|
||||
PACKET_ENCRYPTION_KEY_REQUEST = 0xfd,
|
||||
PACKET_PING = 0xfe,
|
||||
PACKET_KICK = 0xff,
|
||||
|
||||
// Synonyms:
|
||||
PACKET_DISCONNECT = PACKET_KICK,
|
||||
} ;
|
||||
|
||||
|
||||
@ -568,6 +571,7 @@ bool cConnection::DecodeClientsPackets(const char * a_Data, int a_Size)
|
||||
case PACKET_CHAT_MESSAGE: HANDLE_CLIENT_READ(HandleClientChatMessage); break;
|
||||
case PACKET_CLIENT_STATUSES: HANDLE_CLIENT_READ(HandleClientClientStatuses); break;
|
||||
case PACKET_CREATIVE_INVENTORY_ACTION: HANDLE_CLIENT_READ(HandleClientCreativeInventoryAction); break;
|
||||
case PACKET_DISCONNECT: HANDLE_CLIENT_READ(HandleClientDisconnect); break;
|
||||
case PACKET_ENCRYPTION_KEY_RESPONSE: HANDLE_CLIENT_READ(HandleClientEncryptionKeyResponse); break;
|
||||
case PACKET_ENTITY_ACTION: HANDLE_CLIENT_READ(HandleClientEntityAction); break;
|
||||
case PACKET_HANDSHAKE: HANDLE_CLIENT_READ(HandleClientHandshake); break;
|
||||
@ -843,6 +847,19 @@ bool cConnection::HandleClientCreativeInventoryAction(void)
|
||||
|
||||
|
||||
|
||||
bool cConnection::HandleClientDisconnect(void)
|
||||
{
|
||||
HANDLE_CLIENT_PACKET_READ(ReadBEUTF16String16, AString, Reason);
|
||||
Log("Received a PACKET_DISCONNECT from the client:");
|
||||
Log(" Reason = \"%s\"", Reason.c_str());
|
||||
COPY_TO_SERVER();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
bool cConnection::HandleClientEncryptionKeyResponse(void)
|
||||
{
|
||||
HANDLE_CLIENT_PACKET_READ(ReadBEShort, short, EncKeyLength);
|
||||
|
@ -115,6 +115,7 @@ protected:
|
||||
bool HandleClientChatMessage(void);
|
||||
bool HandleClientClientStatuses(void);
|
||||
bool HandleClientCreativeInventoryAction(void);
|
||||
bool HandleClientDisconnect(void);
|
||||
bool HandleClientEncryptionKeyResponse(void);
|
||||
bool HandleClientEntityAction(void);
|
||||
bool HandleClientHandshake(void);
|
||||
|
@ -136,17 +136,28 @@ bool cIsThread::Wait(void)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
LOGD("Waiting for thread %s to finish", m_ThreadName.c_str());
|
||||
|
||||
#ifdef LOGD // ProtoProxy doesn't have LOGD
|
||||
LOGD("Waiting for thread %s to finish", m_ThreadName.c_str());
|
||||
#endif // LOGD
|
||||
|
||||
#ifdef _WIN32
|
||||
int res = WaitForSingleObject(m_Handle, INFINITE);
|
||||
m_Handle = NULL;
|
||||
LOGD("Thread %s finished", m_ThreadName.c_str());
|
||||
|
||||
#ifdef LOGD // ProtoProxy doesn't have LOGD
|
||||
LOGD("Thread %s finished", m_ThreadName.c_str());
|
||||
#endif // LOGD
|
||||
|
||||
return (res == WAIT_OBJECT_0);
|
||||
#else // _WIN32
|
||||
int res = pthread_join(m_Handle, NULL);
|
||||
m_Handle = NULL;
|
||||
LOGD("Thread %s finished", m_ThreadName.c_str());
|
||||
|
||||
#ifdef LOGD // ProtoProxy doesn't have LOGD
|
||||
LOGD("Thread %s finished", m_ThreadName.c_str());
|
||||
#endif // LOGD
|
||||
|
||||
m_HasStarted = false;
|
||||
return (res == 0);
|
||||
#endif // else _WIN32
|
||||
|
Loading…
Reference in New Issue
Block a user