data = BIO_get_data(bio);
if (!TEST_ptr(data))
return 0;
- data->backoff = 1;
+ data->backoff = (int)num;
ret = 1;
break;
}
i++, thismsg++, data->this_dgram++) {
uint64_t reinject;
int should_drop;
- uint16_t flip;
- size_t flip_offset;
+ uint16_t flip = 0;
+ size_t flip_offset = 0;
/* If we have a message to reinject then insert it now */
if (data->reinject_dgram > 0
* we always ensure that the next datagram does not get dropped so
* that the connection always survives. After that we can resume
* with normal noise
+ * Note that the backoff value is configurable via BIO ctrl,
+ * allowing for multiframe backoff.
*/
#ifdef OSSL_NOISY_DGRAM_DEBUG
printf("**Back off applied\n");
#endif
should_drop = 0;
flip = 0;
- data->backoff = 0;
+ data->backoff--;
}
flip_bits(thismsg->data, thismsg->data_len, flip, flip_offset);
* of our noise being too much such that the connection itself
* fails. We back off on the noise for a bit to avoid that.
*/
- (void)BIO_ctrl(noiseargs->cbio, BIO_CTRL_NOISE_BACK_OFF, 0, NULL);
- (void)BIO_ctrl(noiseargs->sbio, BIO_CTRL_NOISE_BACK_OFF, 0, NULL);
+ (void)BIO_ctrl(noiseargs->cbio, BIO_CTRL_NOISE_BACK_OFF, 1, NULL);
+ (void)BIO_ctrl(noiseargs->sbio, BIO_CTRL_NOISE_BACK_OFF, 1, NULL);
}
}
goto err;
}
- (void)BIO_ctrl(sbio, BIO_CTRL_NOISE_BACK_OFF, 0, NULL);
+ (void)BIO_ctrl(sbio, BIO_CTRL_NOISE_BACK_OFF, 2, NULL);
(*fault)->noiseargs.cbio = cbio;
(*fault)->noiseargs.sbio = sbio;