Browse Source

Address streams stuck in wait-close state

Emagi 1 year ago
parent
commit
b47c8546e4
2 changed files with 11 additions and 21 deletions
  1. 1 19
      EQ2/source/common/EQStream.cpp
  2. 10 2
      EQ2/source/common/EQStreamFactory.cpp

+ 1 - 19
EQ2/source/common/EQStream.cpp

@@ -1726,25 +1726,7 @@ DumpPacket(buffer, length);
 		{
 			cout << "2Orig Packet: " << opcode << endl;
 			DumpPacket(newbuffer, newlength);
-			MCombineQueueLock.lock();
-			EQProtocolPacket* p2 = ProcessEncryptedData(newbuffer, newlength, OP_Packet);
-			MCombineQueueLock.unlock();
-			cout << "2Decrypted Packet: " << p2->opcode << endl;
-			DumpPacket(p2->pBuffer, p2->size);
-				
-				
-			// this can be partial packets and needs more consideration, it only seems to happen I have seen for character portraits -> server
-			// this is a TODO, keeping it in place since last encounter it is a partial portait packet but the opcode is provided
-			EQApplicationPacket *res = new EQApplicationPacket;
-			res->opcode = p2->opcode;
-			res->size = p2->size;
-			
-			res->pBuffer= new unsigned char[p2->size];
-			memcpy(res->pBuffer,p2->pBuffer,p2->size);
-			res->copyInfo(p2);
-			InboundQueuePush(res);
-
-			safe_delete(p2);
+			ProcessEmbeddedPacket(newbuffer, newlength, OP_Fragment);
 		}
 		ProcessQueue();
 	} else {

+ 10 - 2
EQ2/source/common/EQStreamFactory.cpp

@@ -283,14 +283,22 @@ void EQStreamFactory::CheckTimeout(bool remove_all)
 			case CLOSED:
 				stateString = "Closed";
 				break;
+			case WAIT_CLOSE:
+				stateString = "Wait-Close";
+				break;
 			default:
 				stateString = "Unknown";
 				break;
 			}
-			LogWrite(WORLD__DEBUG, 0, "World", "Timeout up!, state=%s", stateString);
+			LogWrite(WORLD__DEBUG, 0, "World", "Timeout up!, state=%s (%u)", stateString, state);
 			if (state==ESTABLISHED) {
 				s->Close();
-			} else if (state == CLOSING) {
+			}
+			else if (state == WAIT_CLOSE) {
+				s->SetState(CLOSING);
+				state = CLOSING;
+			}
+			else if (state == CLOSING) {
 				//if we time out in the closing state, just give up
 				s->SetState(CLOSED);
 				state = CLOSED;