From f2be05f47f77b1951120925a76162d4520b39701 Mon Sep 17 00:00:00 2001 From: KimLS Date: Mon, 26 Sep 2016 14:51:12 -0700 Subject: [PATCH] Working on compression, still needs work --- common/eq_stream_ident.cpp | 14 +++++++------- common/net/daybreak_connection.cpp | 7 ++++--- world/net.cpp | 2 +- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/common/eq_stream_ident.cpp b/common/eq_stream_ident.cpp index deebd9aee..8890bf05c 100644 --- a/common/eq_stream_ident.cpp +++ b/common/eq_stream_ident.cpp @@ -45,13 +45,13 @@ void EQStreamIdentifier::Process() { Record &r = *cur; //first see if this stream has expired - if(r.expire.Check(false)) { - //this stream has failed to match any pattern in our timeframe. - Log.Out(Logs::General, Logs::Netcode, "[IDENTIFY] Unable to identify stream from %s:%d before timeout.", long2ip(r.stream->GetRemoteIP()).c_str(), ntohs(r.stream->GetRemotePort())); - r.stream->ReleaseFromUse(); - cur = m_streams.erase(cur); - continue; - } + //if(r.expire.Check(false)) { + // //this stream has failed to match any pattern in our timeframe. + // Log.Out(Logs::General, Logs::Netcode, "[IDENTIFY] Unable to identify stream from %s:%d before timeout.", long2ip(r.stream->GetRemoteIP()).c_str(), ntohs(r.stream->GetRemotePort())); + // r.stream->ReleaseFromUse(); + // cur = m_streams.erase(cur); + // continue; + //} //then make sure the stream is still active //if stream hasn't finished initializing then continue; diff --git a/common/net/daybreak_connection.cpp b/common/net/daybreak_connection.cpp index 6d87dc9cb..709b4611c 100644 --- a/common/net/daybreak_connection.cpp +++ b/common/net/daybreak_connection.cpp @@ -383,7 +383,9 @@ void EQ::Net::DaybreakConnection::ProcessPacket(Packet &p) for (int i = 0; i < 2; ++i) { switch (m_encode_passes[i]) { case EncodeCompression: + Log.OutF(Logs::General, Logs::Debug, "Decompressing packet on pass {1}\n{0}", temp.ToString(), i); Decompress(temp, DaybreakHeader::size(), temp.Length() - DaybreakHeader::size() - m_crc_bytes); + Log.OutF(Logs::General, Logs::Debug, "Decompressed packet on pass {1}\n{0}", temp.ToString(), i); break; case EncodeXOR: Decode(temp, DaybreakHeader::size(), temp.Length() - DaybreakHeader::size() - m_crc_bytes); @@ -887,7 +889,7 @@ void EQ::Net::DaybreakConnection::Decompress(Packet &p, size_t offset, size_t le if (length < 2) { return; } - + static uint8_t new_buffer[4096]; uint8_t *buffer = (uint8_t*)p.Data() + offset; uint32_t new_length = 0; @@ -900,8 +902,7 @@ void EQ::Net::DaybreakConnection::Decompress(Packet &p, size_t offset, size_t le new_length = (uint32_t)length - 1; } else { - memcpy(new_buffer, buffer, length); - new_length = length; + return; } p.Resize(offset); diff --git a/world/net.cpp b/world/net.cpp index a723b2aeb..02492ef30 100644 --- a/world/net.cpp +++ b/world/net.cpp @@ -398,7 +398,7 @@ int main(int argc, char** argv) { return 1; } - EQ::Net::EQStreamManagerOptions opts(true, false); + EQ::Net::EQStreamManagerOptions opts(false, true); opts.daybreak_options.port = 9000; opts.opcode_size = 2;