diff options
author | zugz (tox) <mbays+tox@sdf.org> | 2019-12-24 00:00:00 +0000 |
---|---|---|
committer | zugz (tox) <mbays+tox@sdf.org> | 2020-01-22 00:00:02 +0000 |
commit | 886b9a7019954a0b002ba10d260376e4e917a1bb (patch) | |
tree | 7add896bc160e77d0add9fbc7d1afe017f7735e3 /.gitignore | |
parent | e6cbe907ac9605de2ca9294ac15dbfce16991514 (diff) |
workaround for message number saving (fixes #961)
Put a future message number into the save file.
Peers require the message numbers of messages we send to increase
monotonically. If we save the current message number, then send further
messages, then quit without saving (e.g. due to a crash), and then
resume from the old save data, then monotonicity will fail. This commit
works around this problem by introducing an offset when the current
message number, so that even in the above circumstance, as long as fewer
messages than the offset were sent between saving and reloading, the
sent message numbers will increase monotonically.
The choice of offset is a balance between wanting it to be large enough
that there is room for plenty of messages to be sent in the above
scenario, and wanting to avoid the following potential problem: if we
repeatedly save and reload without sending any further messages, then
the message number may increase so far that peers will interpret an
eventual message as being old. This is not conceivably a practical issue
for the 32bit lossless message numbers, but is a concern for the 16bit
lossy message numbers.
Diffstat (limited to '.gitignore')
0 files changed, 0 insertions, 0 deletions