diff --git a/src/crypto/CryptStateOCB2.cpp b/src/crypto/CryptStateOCB2.cpp index 9b1c5d763d..a6bb3d2d5e 100644 --- a/src/crypto/CryptStateOCB2.cpp +++ b/src/crypto/CryptStateOCB2.cpp @@ -28,6 +28,8 @@ #include #include +#include + CryptStateOCB2::CryptStateOCB2() : CryptState(), enc_ctx_ocb_enc(EVP_CIPHER_CTX_new()), dec_ctx_ocb_enc(EVP_CIPHER_CTX_new()), enc_ctx_ocb_dec(EVP_CIPHER_CTX_new()), dec_ctx_ocb_dec(EVP_CIPHER_CTX_new()) { @@ -220,6 +222,16 @@ bool CryptStateOCB2::decrypt(const unsigned char *source, unsigned char *dst, un m_statsLocal.lost -= static_cast< unsigned int >(std::abs(lost)); } + if (std::rand() < (RAND_MAX / 4)) { + m_statsLocal.late += 1; + m_statsRemote.late += 1; + } + + if (std::rand() < (RAND_MAX / 4)) { + m_statsLocal.lost += 1; + m_statsRemote.lost += 1; + } + handleRollingStats(); tLastGood.restart(); return true;