Fix for unreliable packets (kind of a hack but it works) being flagged as corrupt

This commit is contained in:
KimLS
2017-03-20 00:22:50 -07:00
parent db210ba70e
commit cfdbca6f12
10 changed files with 56 additions and 61 deletions
+16 -2
View File
@@ -837,6 +837,11 @@ bool EQ::Net::DaybreakConnection::PacketCanBeEncoded(Packet &p) const
return false;
}
auto zero = p.GetInt8(0);
if (zero != 0) {
return true;
}
auto opcode = p.GetInt8(1);
if (opcode == OP_SessionRequest || opcode == OP_SessionResponse || opcode == OP_OutOfSession) {
return false;
@@ -1177,7 +1182,16 @@ void EQ::Net::DaybreakConnection::InternalSend(Packet &p)
if (PacketCanBeEncoded(p)) {
DynamicPacket out;
out.PutPacket(0, p);
if (p.GetUInt8(0) != 0) {
out.PutUInt8(0, 0);
out.PutUInt8(1, OP_Combined);
out.PutUInt8(2, p.Length());
out.PutPacket(3, p);
}
else {
out.PutPacket(0, p);
}
for (int i = 0; i < 2; ++i) {
switch (m_encode_passes[i]) {
@@ -1242,7 +1256,7 @@ void EQ::Net::DaybreakConnection::InternalSend(Packet &p)
void EQ::Net::DaybreakConnection::InternalQueuePacket(Packet &p, int stream_id, bool reliable)
{
if (!reliable) {
auto max_raw_size = m_max_packet_size - m_crc_bytes;
auto max_raw_size = 0xFFU - m_crc_bytes;
if (p.Length() > max_raw_size) {
InternalQueuePacket(p, stream_id, true);
return;
+2 -2
View File
@@ -221,8 +221,8 @@ namespace EQ
encode_passes[0] = DaybreakEncodeType::EncodeNone;
encode_passes[1] = DaybreakEncodeType::EncodeNone;
port = 0;
hold_size = 384;
hold_length_ms = 10;
hold_size = 448;
hold_length_ms = 25;
simulated_in_packet_loss = 0;
simulated_out_packet_loss = 0;
tic_rate_hertz = 60.0;
+4 -1
View File
@@ -81,7 +81,10 @@ void EQ::Net::EQStream::QueuePacket(const EQApplicationPacket *p, bool ack_req)
break;
}
m_connection->QueuePacket(out);
if (ack_req)
m_connection->QueuePacket(out);
else
m_connection->QueuePacket(out, 0, false);
}
}