Lines Matching refs:bo
287 static void backoff_context_init(struct backoff_context *bo) in backoff_context_init() argument
289 __ASSERT_NO_MSG(bo != NULL); in backoff_context_init()
291 bo->retries_count = 0u; in backoff_context_init()
292 bo->max_retries = MAX_RETRIES; in backoff_context_init()
295 bo->attempt_max_backoff = BACKOFF_EXP_BASE_MS; in backoff_context_init()
296 bo->max_backoff = BACKOFF_EXP_MAX_MS; in backoff_context_init()
301 static void backoff_get_next(struct backoff_context *bo, uint32_t *next_backoff_ms) in backoff_get_next() argument
303 __ASSERT_NO_MSG(bo != NULL); in backoff_get_next()
307 if (bo->retries_count <= bo->max_retries) { in backoff_get_next()
308 *next_backoff_ms = sys_rand32_get() % (bo->attempt_max_backoff + 1u); in backoff_get_next()
311 bo->attempt_max_backoff = MIN(bo->attempt_max_backoff * 2u, bo->max_backoff); in backoff_get_next()
312 bo->retries_count++; in backoff_get_next()
323 struct backoff_context bo; in aws_client_try_connect() local
325 backoff_context_init(&bo); in aws_client_try_connect()
327 while (bo.retries_count <= bo.max_retries) { in aws_client_try_connect()
333 backoff_get_next(&bo, &backoff_ms); in aws_client_try_connect()