Browse Source

Start a disconnect timer on a bad password or bad version login attempt

Fix #144
Image 3 years ago
parent
commit
8c9c5233df
2 changed files with 20 additions and 4 deletions
  1. 18 4
      EQ2/source/LoginServer/client.cpp
  2. 2 0
      EQ2/source/LoginServer/client.h

+ 18 - 4
EQ2/source/LoginServer/client.cpp

@@ -101,8 +101,13 @@ bool Client::Process() {
 		safe_delete(playWaitTimer);
 		start = true;
 	}
-	//if(disconnectTimer && disconnectTimer->Check())
-	//	getConnection()->SendDisconnect();
+	
+	if (disconnectTimer && disconnectTimer->Check())
+	{
+		safe_delete(disconnectTimer);
+		getConnection()->SendDisconnect();
+	}
+	
 	if (!kicked) {
 		/************ Get all packets from packet manager out queue and process them ************/
 		EQApplicationPacket *app = 0;
@@ -504,6 +509,7 @@ void Client::SendLoginDeniedBadVersion(){
 	ls_response->unknown03 = 0xFFFFFFFF;
 	ls_response->unknown04 = 0xFFFFFFFF;
 	QueuePacket(app);
+	StartDisconnectTimer();
 }
 void Client::SendLoginDenied(){
 	EQ2Packet* app = new EQ2Packet(OP_LoginReplyMsg, 0, sizeof(LS_LoginResponse));
@@ -512,6 +518,7 @@ void Client::SendLoginDenied(){
 	ls_response->unknown03 = 0xFFFFFFFF;
 	ls_response->unknown04 = 0xFFFFFFFF;
 	QueuePacket(app);
+	StartDisconnectTimer();
 }
 
 void Client::SendLoginAccepted() {
@@ -588,8 +595,6 @@ void Client::WorldResponse(int32 worldid, int8 response, char* ip_address, int32
 		EQ2Packet* outapp = response_packet->serialize();
 		QueuePacket(outapp);
 		safe_delete(response_packet);
-		disconnectTimer = new Timer(1000);
-		disconnectTimer->Start();
 	}
 	return;
 }
@@ -703,3 +708,12 @@ void ClientList::Process() {
 		MClientList.releasewritelock();
 	}
 }
+
+
+void Client::StartDisconnectTimer() {
+	if (!disconnectTimer)
+	{
+		disconnectTimer = new Timer(1000);
+		disconnectTimer->Start();
+	}
+}

+ 2 - 0
EQ2/source/LoginServer/client.h

@@ -71,6 +71,8 @@ public:
 	int32	request_num;
 	LinkedList<DelayQue*> delay_que;
 	void SendPlayFailed(int8 response);
+
+	void StartDisconnectTimer();
 private:
 	string	pending_play_char_name;
 	int32	pending_play_char_id;