Skip to content

Commit

Permalink
whoops I screwed up the replay protection fix.
Browse files Browse the repository at this point in the history
  • Loading branch information
gafferongames committed Apr 17, 2019
1 parent b5173ce commit 1dd10f8
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions netcode.c
Original file line number Diff line number Diff line change
Expand Up @@ -1669,18 +1669,13 @@ int netcode_replay_protection_already_received( struct netcode_replay_protection
if ( sequence + NETCODE_REPLAY_PROTECTION_BUFFER_SIZE <= replay_protection->most_recent_sequence )
return 1;

if ( sequence > replay_protection->most_recent_sequence )
replay_protection->most_recent_sequence = sequence;

int index = (int) ( sequence % NETCODE_REPLAY_PROTECTION_BUFFER_SIZE );

if ( replay_protection->received_packet[index] == 0xFFFFFFFFFFFFFFFFLL )
return 0;

if ( replay_protection->received_packet[index] >= sequence )
return 1;

replay_protection->received_packet[index] = sequence;

return 0;
}
Expand All @@ -1694,10 +1689,7 @@ void netcode_replay_protection_advance_sequence( struct netcode_replay_protectio

int index = (int) ( sequence % NETCODE_REPLAY_PROTECTION_BUFFER_SIZE );

if ( replay_protection->received_packet[index] == 0xFFFFFFFFFFFFFFFFLL )
{
replay_protection->received_packet[index] = sequence;
}
replay_protection->received_packet[index] = sequence;
}

void * netcode_read_packet( uint8_t * buffer,
Expand Down

0 comments on commit 1dd10f8

Please sign in to comment.