tolerate 50 ms difference to cover low timer resolution
@@ -54,6 +54,8 @@ void mock_client(int writefd, int readfd)
s2n_negotiate(conn, &blocked);
+ uint16_t timeout = 1;
+ s2n_connection_set_dynamic_record_threshold(conn, 0x7fff, timeout);
int i;
for (i = 1; i < 0xffff - 100; i += 100) {
for (int j = 0; j < i; j++) {
@@ -66,10 +68,8 @@ void mock_client(int writefd, int readfd)
buffer[j] = 33;
}
- uint16_t timeout = 1;
- s2n_connection_set_dynamic_record_threshold(conn, i / 2, timeout);
- /* Simulate timeout second conneciton inactivity*/
- sleep(1);
+ /* Simulate timeout second conneciton inactivity and tolerate 50 ms difference */
+ usleep(1000000 * timeout + 50000);
/* Active application bytes consumed is reset to 0 in before writing data. */
/* Its value should equal to bytes written after writing */
ssize_t bytes_written = s2n_send(conn, buffer, i, &blocked);
