diff options
author | hqwrong <hq.wrong@gmail.com> | 2018-04-02 21:21:28 +0800 |
---|---|---|
committer | hqwrong <lazyrobot@protonmail.com> | 2018-04-03 17:24:49 +0800 |
commit | 7fa0c89c96bdaf45bf202d770aa56dc7c68959b9 (patch) | |
tree | d10489e2b66573c06e909e5ea3f2e486440b4a70 /toxcore/net_crypto.c | |
parent | eb6b602095d177a61eafe86d5da567a971697e86 (diff) |
add comment to func cryptpacket_received
Diffstat (limited to 'toxcore/net_crypto.c')
-rw-r--r-- | toxcore/net_crypto.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/toxcore/net_crypto.c b/toxcore/net_crypto.c index 65c81d92..2e8299f1 100644 --- a/toxcore/net_crypto.c +++ b/toxcore/net_crypto.c | |||
@@ -2755,6 +2755,13 @@ int64_t write_cryptpacket(Net_Crypto *c, int crypt_connection_id, const uint8_t | |||
2755 | * | 2755 | * |
2756 | * return -1 on failure. | 2756 | * return -1 on failure. |
2757 | * return 0 on success. | 2757 | * return 0 on success. |
2758 | * | ||
2759 | * Note: The condition `buffer_end - buffer_start < packet_number - buffer_start` is | ||
2760 | * a trick which handles situations `buffer_end >= buffer_start` and | ||
2761 | * `buffer_end < buffer_start`(when buffer_end overflowed) both correctly | ||
2762 | * | ||
2763 | * It CANNOT be simplified to `packet_number < buffer_start`, as it will fail | ||
2764 | * when `buffer_end < buffer_start`. | ||
2758 | */ | 2765 | */ |
2759 | int cryptpacket_received(Net_Crypto *c, int crypt_connection_id, uint32_t packet_number) | 2766 | int cryptpacket_received(Net_Crypto *c, int crypt_connection_id, uint32_t packet_number) |
2760 | { | 2767 | { |