Move did handshake logic to connection data plus an optimization

Signed-off-by: puvvadar <puvvadar@amazon.com>
This commit is contained in:
puvvadar
2021-09-30 19:59:34 -07:00
parent 8581b30260
commit 2811a84187
9 changed files with 66 additions and 15 deletions
@@ -6,15 +6,24 @@ namespace {{ xml.attrib['Name'] }}
{
switch (aznumeric_cast<int32_t>(packetHeader.GetPacketType()))
{
{% set hs = namespace(handshake=false) %}
{% for Packet in xml.iter('Packet') %}
{% if ('HandshakePacket' in Packet.attrib) and (Packet.attrib['HandshakePacket'] == 'true') %}
{% set hs.handshake = True %}
{% endif %}
{% endfor %}
{% for Packet in xml.iter('Packet') %}
case aznumeric_cast<int32_t>({{ Packet.attrib['Name'] }}::Type):
{
AZLOG(Debug_DispatchPackets, "Received packet %s", "{{ Packet.attrib['Name'] }}");
{% if hs.handshake %}
{% if ('HandshakePacket' not in Packet.attrib) or (Packet.attrib['HandshakePacket'] == 'false') %}
if (!handler.IsHandshakeComplete())
if (!handler.IsHandshakeComplete(connection))
{
return AzNetworking::PacketDispatchResult::Skipped;
}
{% endif %}
{% endif %}
{{ Packet.attrib['Name'] }} packet;