Fix server->client desync
Fix #85 - Remove restrictions on combined packets - Reset the compression to the previous design - Client bulk updates now send in one big sweep bulk packet versus a grouping of packets
This commit is contained in:
parent
4c50870208
commit
eb7c5347d7
3 changed files with 16 additions and 17 deletions
|
@ -236,7 +236,7 @@ Client::~Client() {
|
|||
UpdateWindowTitle(0);
|
||||
}
|
||||
|
||||
void Client::QueuePacket(EQ2Packet* app){
|
||||
void Client::QueuePacket(EQ2Packet* app, bool attemptedCombine){
|
||||
if(eqs){
|
||||
if(!eqs->CheckActive()){
|
||||
client_list.Remove(this);
|
||||
|
@ -244,7 +244,7 @@ void Client::QueuePacket(EQ2Packet* app){
|
|||
}
|
||||
}
|
||||
if(app && eqs && version > 0)
|
||||
eqs->EQ2QueuePacket(app);
|
||||
eqs->EQ2QueuePacket(app, attemptedCombine);
|
||||
else{
|
||||
safe_delete(app);
|
||||
}
|
||||
|
@ -8258,7 +8258,7 @@ void Client::SendSpawnChanges(set<Spawn*>& spawns) {
|
|||
|
||||
int count = 0;
|
||||
for (const auto& spawn : spawns) {
|
||||
if (count > 40 || (info_size+pos_size+vis_size) > 400)
|
||||
/* if (count > 50 || (info_size+pos_size+vis_size) > 200)
|
||||
{
|
||||
MakeSpawnChangePacket(info_changes, pos_changes, vis_changes, info_size, pos_size, vis_size);
|
||||
|
||||
|
@ -8279,11 +8279,11 @@ void Client::SendSpawnChanges(set<Spawn*>& spawns) {
|
|||
info_size = 0;
|
||||
pos_size = 0;
|
||||
vis_size = 0;
|
||||
}
|
||||
}*/
|
||||
|
||||
if (!player->WasSentSpawn(spawn->GetID()))
|
||||
int16 index = GetPlayer()->GetIndexForSpawn(spawn);
|
||||
if (index == 0)
|
||||
continue;
|
||||
int16 index = player->player_spawn_index_map[spawn];
|
||||
|
||||
if (spawn->info_changed) {
|
||||
auto info_change = spawn->spawn_info_changes_ex(GetPlayer(), GetVersion());
|
||||
|
|
|
@ -147,7 +147,7 @@ public:
|
|||
bool IsReadyForUpdates() { return ready_for_updates; }
|
||||
bool IsZoning(){ return client_zoning; }
|
||||
void SetReadyForSpawns(bool val);
|
||||
void QueuePacket(EQ2Packet* app);
|
||||
void QueuePacket(EQ2Packet* app, bool attemptedCombine=false);
|
||||
void SendLoginInfo();
|
||||
void SimpleMessage(int8 color, const char* message);
|
||||
void Message(int8 type, const char* message, ...);
|
||||
|
|
|
@ -243,8 +243,8 @@ void EQStream::ProcessPacket(EQProtocolPacket *p)
|
|||
#endif
|
||||
while(processed<p->size) {
|
||||
if ((subpacket_length=(unsigned char)*(p->pBuffer+processed))==0xff) {
|
||||
subpacket_length=255;
|
||||
offset = 1;
|
||||
subpacket_length = ntohs(*(uint16*)(p->pBuffer + processed + 1));
|
||||
offset = 3;
|
||||
}
|
||||
else
|
||||
offset = 1;
|
||||
|
@ -597,20 +597,19 @@ int8 EQStream::EQ2_Compress(EQ2Packet* app, int8 offset){
|
|||
#endif
|
||||
|
||||
uchar* pDataPtr = app->pBuffer + offset;
|
||||
int xpandSize = app->size * 2;
|
||||
uchar* deflate_buff = new uchar[xpandSize];
|
||||
uchar* deflate_buff = new uchar[app->size];
|
||||
MCompressData.lock();
|
||||
stream.next_in = pDataPtr;
|
||||
stream.next_in = pDataPtr;
|
||||
stream.avail_in = app->size - offset;
|
||||
stream.next_out = deflate_buff;
|
||||
stream.avail_out = xpandSize;
|
||||
stream.avail_out = app->size;
|
||||
|
||||
deflate(&stream, Z_SYNC_FLUSH);
|
||||
int32 newsize = xpandSize - stream.avail_out;
|
||||
int32 newsize = app->size - stream.avail_out;
|
||||
safe_delete_array(app->pBuffer);
|
||||
app->size = newsize + offset;
|
||||
app->pBuffer = new uchar[app->size];
|
||||
app->pBuffer[(offset-1)] = 1;
|
||||
app->pBuffer[(offset - 1)] = 1;
|
||||
memcpy(app->pBuffer + offset, deflate_buff, newsize);
|
||||
MCompressData.unlock();
|
||||
safe_delete_array(deflate_buff);
|
||||
|
@ -667,7 +666,7 @@ void EQStream::EncryptPacket(EQ2Packet* app, int8 compress_offset, int8 offset){
|
|||
|
||||
void EQStream::EQ2QueuePacket(EQ2Packet* app, bool attempted_combine){
|
||||
if(CheckActive()){
|
||||
if(app->size < 600 && !attempted_combine){
|
||||
if(!attempted_combine){
|
||||
MCombineQueueLock.lock();
|
||||
combine_queue.push_back(app);
|
||||
MCombineQueueLock.unlock();
|
||||
|
@ -898,7 +897,7 @@ bool EQStream::CheckCombineQueue(){
|
|||
//DumpPacket(first);
|
||||
}
|
||||
MCombineQueueLock.lock();
|
||||
if(count >= 20){ //other clients need packets too
|
||||
if(count >= 10){ //other clients need packets too
|
||||
ret = false;
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue