add comment to func cryptpacket_received

This commit is contained in:
hqwrong 2018-04-02 21:21:28 +08:00 committed by hqwrong
parent eb6b602095
commit 7fa0c89c96
No known key found for this signature in database
GPG Key ID: 9E1257FC660267A3

View File

@ -2755,6 +2755,13 @@ int64_t write_cryptpacket(Net_Crypto *c, int crypt_connection_id, const uint8_t
* *
* return -1 on failure. * return -1 on failure.
* return 0 on success. * return 0 on success.
*
* Note: The condition `buffer_end - buffer_start < packet_number - buffer_start` is
* a trick which handles situations `buffer_end >= buffer_start` and
* `buffer_end < buffer_start`(when buffer_end overflowed) both correctly
*
* It CANNOT be simplified to `packet_number < buffer_start`, as it will fail
* when `buffer_end < buffer_start`.
*/ */
int cryptpacket_received(Net_Crypto *c, int crypt_connection_id, uint32_t packet_number) int cryptpacket_received(Net_Crypto *c, int crypt_connection_id, uint32_t packet_number)
{ {