Skip to content

Commit b70641b

Browse files
Update version, change retry forever macro, and add C++ header guards (#29)
* Update version number * Add header guard for C++ linkage * Link to size table from README * Change retry forever macro from 0 to UINT32_MAX * Update CHANGELOG.md Co-authored-by: Archit Aggarwal <[email protected]>
1 parent 57c9820 commit b70641b

File tree

13 files changed

+37
-20
lines changed

13 files changed

+37
-20
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,4 +112,4 @@ jobs:
112112
uses: FreeRTOS/CI-CD-Github-Actions/memory_statistics@main
113113
with:
114114
config: .github/memory_statistics_config.json
115-
check_against: docs/doxygen/include/size_table.html
115+
check_against: docs/doxygen/include/size_table.md

.github/workflows/memory_statistics.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ jobs:
1919
uses: actions/upload-artifact@v2
2020
with:
2121
name: size_table
22-
path: size_table.html
22+
path: size_table.md

CHANGELOG.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
# Changelog for backoffAlgorithm Library
22

3-
## Changes after v1.0.1
4-
- [#27](https://github.com/FreeRTOS/backoffAlgorithm/pull/26) Fix incorrect comment about use of BACKOFF_ALGORITHM_RETRY_FOREVER constant in BackoffAlgorithm_GetNextBackoff API.
3+
## v1.1.0 (July 2021)
54

6-
## v1.0.1 (February 2020)
5+
### Changes
6+
7+
- [#29](https://github.com/FreeRTOS/backoffAlgorithm/pull/29) Set BACKOFF_ALGORITHM_RETRY_FOREVER to be nonzero and add header guards for C++ linkage.
8+
- [#27](https://github.com/FreeRTOS/backoffAlgorithm/pull/27) Fix incorrect comment about use of BACKOFF_ALGORITHM_RETRY_FOREVER constant in BackoffAlgorithm_GetNextBackoff API.
9+
10+
## v1.0.1 (February 2021)
711

812
### Changes
913

@@ -16,4 +20,4 @@ This is the first release of the backoffAlgorithm library in this repository.
1620

1721
The backoffAlgorithm library is a utility library to calculate backoff period using an exponential backoff with jitter algorithm for retrying network operations (like failed network connection with server).
1822
This library uses the "Full Jitter" strategy for the exponential backoff with jitter algorithm.
19-
More information about the algorithm can be seen in the [Exponential Backoff and Jitter](https://aws.amazon.com/blogs/architecture/exponential-backoff-and-jitter/) AWS blog.
23+
More information about the algorithm can be seen in the [Exponential Backoff and Jitter](https://aws.amazon.com/blogs/architecture/exponential-backoff-and-jitter/) AWS blog.

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Besides, in an environment with poor connectivity, a client can get disconnected
1414
A backoff strategy helps the client to conserve battery by not repeatedly attempting reconnections when they are
1515
unlikely to succeed.
1616

17-
See memory requirements for this library [here](https://docs.aws.amazon.com/embedded-csdk/202103.00/lib-ref/libraries/standard/backoffAlgorithm/docs/doxygen/output/html/index.html#backoff_algorithm_memory_requirements).
17+
See memory requirements for this library [here](./docs/doxygen/include/size_table.md).
1818

1919
**backoffAlgorithm v1.0.0 [source code](https://github.com/FreeRTOS/backoffAlgorithm/tree/v1.0.0/source) is part of the [FreeRTOS 202012.00 LTS](https://github.com/FreeRTOS/FreeRTOS-LTS/tree/202012.00-LTS) release.**
2020

@@ -129,7 +129,7 @@ By default, the submodules in this repository are configured with `update=none`
129129

130130
To build unit tests, the submodule dependency of Unity is required. Use the following command to clone the submodule:
131131
```
132-
git submodule update --checkout --init --recursive --test/unit-test/Unity
132+
git submodule update --checkout --init --recursive test/unit-test/Unity
133133
```
134134

135135
### Platform Prerequisites

docs/doxygen/config.doxyfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ PROJECT_NAME = "backoffAlgorithm"
3838
# could be handy for archiving the generated documentation or if some version
3939
# control system is used.
4040

41-
PROJECT_NUMBER = "v1.0.1"
41+
PROJECT_NUMBER = "v1.1.0"
4242

4343
# Using the PROJECT_BRIEF tag one can provide an optional one line description
4444
# for a project that appears at the top of each page and should give viewer a

docs/doxygen/pages.dox

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ For a reference example of using the library, refer to the related README sectio
3434
@section backoff_algorithm_memory_requirements Memory Requirements
3535
@brief Memory requirements of the backoffAlgorithm library.
3636

37-
@include{doc} size_table.html
37+
@include{doc} size_table.md
3838

3939
@section backoff_algorithm_design Design
4040
@brief backoffAlgorithm Library Design

lexicon.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ mainpage
3232
maxattempts
3333
maxbackoff
3434
maxretryattempts
35+
md
3536
min
3637
misra
3738
mockrng
@@ -56,4 +57,4 @@ td
5657
toolchain
5758
tr
5859
trng
59-
utils
60+
utils

manifest.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name : "backoffAlgorithm"
2-
version: "v1.0.1"
2+
version: "v1.1.0"
33
description: |
44
"Algorithm for calculating exponential backoff with jitter for network retry attempts.\n"
55
license: "MIT"

source/backoff_algorithm.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* backoffAlgorithm v1.0.1
2+
* backoffAlgorithm v1.1.0
33
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
44
*
55
* Permission is hereby granted, free of charge, to any person obtaining a copy of
@@ -44,9 +44,9 @@ BackoffAlgorithmStatus_t BackoffAlgorithm_GetNextBackoff( BackoffAlgorithmContex
4444
assert( pRetryContext != NULL );
4545
assert( pNextBackOff != NULL );
4646

47-
/* If maxRetryAttempts state of the context is set to 0, retry forever. */
48-
if( ( pRetryContext->attemptsDone < pRetryContext->maxRetryAttempts ) ||
49-
( pRetryContext->maxRetryAttempts == BACKOFF_ALGORITHM_RETRY_FOREVER ) )
47+
/* If maxRetryAttempts state of the context is set to the maximum, retry forever. */
48+
if( ( pRetryContext->maxRetryAttempts == BACKOFF_ALGORITHM_RETRY_FOREVER ) ||
49+
( pRetryContext->attemptsDone < pRetryContext->maxRetryAttempts ) )
5050
{
5151
/* The next backoff value is a random value between 0 and the maximum jitter value
5252
* for the retry attempt. */

source/include/backoff_algorithm.h

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* backoffAlgorithm v1.0.1
2+
* backoffAlgorithm v1.1.0
33
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
44
*
55
* Permission is hereby granted, free of charge, to any person obtaining a copy of
@@ -36,11 +36,17 @@
3636
/* Standard include. */
3737
#include <stdint.h>
3838

39+
/* *INDENT-OFF* */
40+
#ifdef __cplusplus
41+
extern "C" {
42+
#endif
43+
/* *INDENT-ON* */
44+
3945
/**
4046
* @ingroup backoff_algorithm_constants
4147
* @brief Constant to represent unlimited number of retry attempts.
4248
*/
43-
#define BACKOFF_ALGORITHM_RETRY_FOREVER ( 0U )
49+
#define BACKOFF_ALGORITHM_RETRY_FOREVER ( UINT32_MAX )
4450

4551
/**
4652
* @ingroup backoff_algorithm_enum_types
@@ -130,4 +136,10 @@ BackoffAlgorithmStatus_t BackoffAlgorithm_GetNextBackoff( BackoffAlgorithmContex
130136
uint16_t * pNextBackOff );
131137
/* @[define_backoffalgorithm_getnextbackoff] */
132138

139+
/* *INDENT-OFF* */
140+
#ifdef __cplusplus
141+
}
142+
#endif
143+
/* *INDENT-ON* */
144+
133145
#endif /* ifndef BACKOFF_ALGORITHM_H_ */

test/unit-test/backoff_algorithm_utest.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* backoffAlgorithm v1.0.1
2+
* backoffAlgorithm v1.1.0
33
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
44
*
55
* Permission is hereby granted, free of charge, to any person obtaining a copy of

test/unit-test/catch_assert.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* backoffAlgorithm v1.0.1
2+
* backoffAlgorithm v1.1.0
33
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
44
*
55
* Permission is hereby granted, free of charge, to any person obtaining a copy of

0 commit comments

Comments
 (0)