-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Drop known chunks. Fixes duplicated chat messages.
- Loading branch information
1 parent
deb679d
commit 6fa0cc9
Showing
3 changed files
with
45 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# frozen_string_literal: true | ||
|
||
## | ||
# Only used for chunks where the sequence number does not match the expected value | ||
# to decide wether to drop known chunks silently or request resend if something got lost | ||
# | ||
# true - if the sequence number is already known and the chunk should be dropped | ||
# false - if the sequence number is off and we need to request a resend of lost chunks | ||
# | ||
# @return [Boolean] | ||
def seq_in_backroom?(seq, ack) | ||
bottom = ack - NET_MAX_SEQUENCE / 2 | ||
if bottom.negative? | ||
return true if seq <= ack | ||
return true if seq >= (bottom + NET_MAX_SEQUENCE) | ||
else | ||
return true if seq <= ack && seq >= bottom | ||
end | ||
return false | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters