pjproject: bump to 2.10 + sync with asterisk
[feed/telephony.git] / libs / pjproject / patches / 0020-pjlib_cancel_timer_0.patch
1 commit 40dd48d10911f4ff9b8dfbf16428fbc9acc434ba
2 Author: Riza Sulistyo <trengginas@users.noreply.github.com>
3 Date: Thu Jul 9 17:47:24 2020 +0700
4
5 Modify timer_id check on cancel() (#2463)
6
7 * modify timer_id check on cancel().
8
9 * modification based on comments.
10
11 --- a/pjlib/include/pj/timer.h
12 +++ b/pjlib/include/pj/timer.h
13 @@ -120,7 +120,10 @@ typedef struct pj_timer_entry
14
15 /**
16 * Internal unique timer ID, which is assigned by the timer heap.
17 - * Application should not touch this ID.
18 + * Positive values indicate that the timer entry is running,
19 + * while -1 means that it's not. Any other value may indicate that it
20 + * hasn't been properly initialised or is in a bad state.
21 + * Application should not touch this ID.
22 */
23 pj_timer_id_t _timer_id;
24
25 --- a/pjlib/src/pj/timer.c
26 +++ b/pjlib/src/pj/timer.c
27 @@ -535,7 +535,7 @@ static int cancel( pj_timer_heap_t *ht,
28 PJ_CHECK_STACK();
29
30 // Check to see if the timer_id is out of range
31 - if (entry->_timer_id < 0 || (pj_size_t)entry->_timer_id > ht->max_size) {
32 + if (entry->_timer_id < 1 || (pj_size_t)entry->_timer_id >= ht->max_size) {
33 entry->_timer_id = -1;
34 return 0;
35 }