Working on compression, still needs work

This commit is contained in:
KimLS 2016-09-26 14:51:12 -07:00
parent 95d4e95400
commit f2be05f47f
3 changed files with 12 additions and 11 deletions

View File

@ -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;

View File

@ -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);

View File

@ -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;