Enable enforcing of network packet constraints. Did I mention asn1c is really cool? Anyway, some constraints are still wrong, so this breaks game creation. I will fix it this evening.

This commit is contained in:
lotodore
2009-08-04 07:26:18 +00:00
parent b81c02245f
commit be31ebf7d6
+5 -2
View File
@@ -54,7 +54,7 @@ ReceiverHelper::ScanPackets(ReceiveBuffer &buf)
// This call will also handle the memmove stuff, i.e.
// buffering for partial packets.
tmpPacket = NetPacket::Create(buf.recvBuf, buf.recvBufUsed);
} catch (const NetException &e)
} catch (const exception &e)
{
// Reset buffer on error.
buf.recvBufUsed = 0;
@@ -64,7 +64,10 @@ ReceiverHelper::ScanPackets(ReceiveBuffer &buf)
if (tmpPacket)
{
//cerr << "IN:" << endl << tmpPacket->ToString() << endl;
buf.receivedPackets.push_back(tmpPacket);
if (asn_check_constraints(&asn_DEF_PokerTHMessage, tmpPacket->GetMsg(), NULL, NULL) == 0)
buf.receivedPackets.push_back(tmpPacket);
else
LOG_ERROR("Invalid packet: " << endl << tmpPacket->ToString());
}
else
dataAvailable = false;