mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-08 02:48:29 +00:00
Compare commits
9 Commits
1.8.30.0
...
1.8.22.0-r
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a3f8d2fe72 | ||
|
|
3514370da0 | ||
|
|
71ea8fc955 | ||
|
|
e54f290e80 | ||
|
|
2e39d8e0a6 | ||
|
|
45c2397f2e | ||
|
|
92caefe09b | ||
|
|
5b240f36b7 | ||
|
|
48384db7ad |
1
.lastclean
Normal file
1
.lastclean
Normal file
@@ -0,0 +1 @@
|
||||
40
|
||||
65
asterisk-1.8.22.0-rc2-summary.html
Normal file
65
asterisk-1.8.22.0-rc2-summary.html
Normal file
@@ -0,0 +1,65 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /><title>Release Summary - asterisk-1.8.22.0-rc2</title></head>
|
||||
<body>
|
||||
<h1 align="center"><a name="top">Release Summary</a></h1>
|
||||
<h3 align="center">asterisk-1.8.22.0-rc2</h3>
|
||||
<h3 align="center">Date: 2013-05-09</h3>
|
||||
<h3 align="center"><asteriskteam@digium.com></h3>
|
||||
<hr/>
|
||||
<h2 align="center">Table of Contents</h2>
|
||||
<ol>
|
||||
<li><a href="#summary">Summary</a></li>
|
||||
<li><a href="#contributors">Contributors</a></li>
|
||||
<li><a href="#commits">Other Changes</a></li>
|
||||
<li><a href="#diffstat">Diffstat</a></li>
|
||||
</ol>
|
||||
<hr/>
|
||||
<a name="summary"><h2 align="center">Summary</h2></a>
|
||||
<center><a href="#top">[Back to Top]</a></center><br/><p>This release includes only bug fixes. The changes included were made only to address problems that have been identified in this release series. Users should be able to safely upgrade to this version if this release series is already in use. Users considering upgrading from a previous release series are strongly encouraged to review the UPGRADE.txt document as well as the CHANGES document for information about upgrading to this release series.</p>
|
||||
<p>The data in this summary reflects changes that have been made since the previous release, asterisk-1.8.22.0-rc1.</p>
|
||||
<hr/>
|
||||
<a name="contributors"><h2 align="center">Contributors</h2></a>
|
||||
<center><a href="#top">[Back to Top]</a></center><br/><p>This table lists the people who have submitted code, those that have tested patches, as well as those that reported issues on the issue tracker that were resolved in this release. For coders, the number is how many of their patches (of any size) were committed into this release. For testers, the number is the number of times their name was listed as assisting with testing a patch. Finally, for reporters, the number is the number of issues that they reported that were closed by commits that went into this release.</p>
|
||||
<table width="100%" border="0">
|
||||
<tr>
|
||||
<td width="33%"><h3>Coders</h3></td>
|
||||
<td width="33%"><h3>Testers</h3></td>
|
||||
<td width="33%"><h3>Reporters</h3></td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td>
|
||||
4 bebuild<br/>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<hr/>
|
||||
<a name="commits"><h2 align="center">Commits Not Associated with an Issue</h2></a>
|
||||
<center><a href="#top">[Back to Top]</a></center><br/><p>This is a list of all changes that went into this release that did not directly close an issue from the issue tracker. The commits may have been marked as being related to an issue. If that is the case, the issue numbers are listed here, as well.</p>
|
||||
<table width="100%" border="1">
|
||||
<tr><td><b>Revision</b></td><td><b>Author</b></td><td><b>Summary</b></td><td><b>Issues Referenced</b></td></tr><tr><td><a href="http://svn.digium.com/view/asterisk/branches/1.8?view=revision&revision=388166">388166</a></td><td>bebuild</td><td>Create 1.8.22.0-rc2</td>
|
||||
<td></td></tr><tr><td><a href="http://svn.digium.com/view/asterisk/branches/1.8?view=revision&revision=388169">388169</a></td><td>bebuild</td><td>Remove old summaries, update version</td>
|
||||
<td></td></tr><tr><td><a href="http://svn.digium.com/view/asterisk/branches/1.8?view=revision&revision=388176">388176</a></td><td>bebuild</td><td>Importing release summary for 1.8.22.0-rc2 release.</td>
|
||||
<td></td></tr><tr><td><a href="http://svn.digium.com/view/asterisk/branches/1.8?view=revision&revision=388195">388195</a></td><td>bebuild</td><td>Merge blockers for 1.8.22.0-rc2</td>
|
||||
<td><a href="https://issues.asterisk.org/jira/browse/ASTERISK-21356">ASTERISK-21356</a>, <a href="https://issues.asterisk.org/jira/browse/ASTERISK-21389">ASTERISK-21389</a>, <a href="https://issues.asterisk.org/jira/browse/ASTERISK-21394">ASTERISK-21394</a>, <a href="https://issues.asterisk.org/jira/browse/ASTERISK-21429">ASTERISK-21429</a></td></tr></table>
|
||||
<hr/>
|
||||
<a name="diffstat"><h2 align="center">Diffstat Results</h2></a>
|
||||
<center><a href="#top">[Back to Top]</a></center><br/><p>This is a summary of the changes to the source code that went into this release that was generated using the diffstat utility.</p>
|
||||
<pre>
|
||||
.version | 2
|
||||
asterisk-1.8.22.0-rc1-summary.html | 299 ----------------------------
|
||||
asterisk-1.8.22.0-rc1-summary.txt | 385 -------------------------------------
|
||||
main/channel.c | 15 +
|
||||
main/devicestate.c | 13 +
|
||||
main/features.c | 23 --
|
||||
res/res_jabber.c | 5
|
||||
res/res_timing_pthread.c | 121 +++++------
|
||||
8 files changed, 98 insertions(+), 765 deletions(-)
|
||||
</pre><br/>
|
||||
<hr/>
|
||||
</body>
|
||||
</html>
|
||||
101
asterisk-1.8.22.0-rc2-summary.txt
Normal file
101
asterisk-1.8.22.0-rc2-summary.txt
Normal file
@@ -0,0 +1,101 @@
|
||||
Release Summary
|
||||
|
||||
asterisk-1.8.22.0-rc2
|
||||
|
||||
Date: 2013-05-09
|
||||
|
||||
<asteriskteam@digium.com>
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Table of Contents
|
||||
|
||||
1. Summary
|
||||
2. Contributors
|
||||
3. Other Changes
|
||||
4. Diffstat
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Summary
|
||||
|
||||
[Back to Top]
|
||||
|
||||
This release includes only bug fixes. The changes included were made only
|
||||
to address problems that have been identified in this release series.
|
||||
Users should be able to safely upgrade to this version if this release
|
||||
series is already in use. Users considering upgrading from a previous
|
||||
release series are strongly encouraged to review the UPGRADE.txt document
|
||||
as well as the CHANGES document for information about upgrading to this
|
||||
release series.
|
||||
|
||||
The data in this summary reflects changes that have been made since the
|
||||
previous release, asterisk-1.8.22.0-rc1.
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Contributors
|
||||
|
||||
[Back to Top]
|
||||
|
||||
This table lists the people who have submitted code, those that have
|
||||
tested patches, as well as those that reported issues on the issue tracker
|
||||
that were resolved in this release. For coders, the number is how many of
|
||||
their patches (of any size) were committed into this release. For testers,
|
||||
the number is the number of times their name was listed as assisting with
|
||||
testing a patch. Finally, for reporters, the number is the number of
|
||||
issues that they reported that were closed by commits that went into this
|
||||
release.
|
||||
|
||||
Coders Testers Reporters
|
||||
4 bebuild
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Commits Not Associated with an Issue
|
||||
|
||||
[Back to Top]
|
||||
|
||||
This is a list of all changes that went into this release that did not
|
||||
directly close an issue from the issue tracker. The commits may have been
|
||||
marked as being related to an issue. If that is the case, the issue
|
||||
numbers are listed here, as well.
|
||||
|
||||
+------------------------------------------------------------------------+
|
||||
| Revision | Author | Summary | Issues Referenced |
|
||||
|----------+---------+-----------------------+---------------------------|
|
||||
| 388166 | bebuild | Create 1.8.22.0-rc2 | |
|
||||
|----------+---------+-----------------------+---------------------------|
|
||||
| 388169 | bebuild | Remove old summaries, | |
|
||||
| | | update version | |
|
||||
|----------+---------+-----------------------+---------------------------|
|
||||
| | | Importing release | |
|
||||
| 388176 | bebuild | summary for | |
|
||||
| | | 1.8.22.0-rc2 release. | |
|
||||
|----------+---------+-----------------------+---------------------------|
|
||||
| | | | ASTERISK-21356, |
|
||||
| 388195 | bebuild | Merge blockers for | ASTERISK-21389, |
|
||||
| | | 1.8.22.0-rc2 | ASTERISK-21394, |
|
||||
| | | | ASTERISK-21429 |
|
||||
+------------------------------------------------------------------------+
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Diffstat Results
|
||||
|
||||
[Back to Top]
|
||||
|
||||
This is a summary of the changes to the source code that went into this
|
||||
release that was generated using the diffstat utility.
|
||||
|
||||
.version | 2
|
||||
asterisk-1.8.22.0-rc1-summary.html | 299 ----------------------------
|
||||
asterisk-1.8.22.0-rc1-summary.txt | 385 -------------------------------------
|
||||
main/channel.c | 15 +
|
||||
main/devicestate.c | 13 +
|
||||
main/features.c | 23 --
|
||||
res/res_jabber.c | 5
|
||||
res/res_timing_pthread.c | 121 +++++------
|
||||
8 files changed, 98 insertions(+), 765 deletions(-)
|
||||
|
||||
----------------------------------------------------------------------
|
||||
@@ -7223,8 +7223,11 @@ static enum ast_bridge_result ast_generic_bridge(struct ast_channel *c0, struct
|
||||
if (c1->_softhangup & AST_SOFTHANGUP_UNBRIDGE) {
|
||||
ast_channel_clear_softhangup(c1, AST_SOFTHANGUP_UNBRIDGE);
|
||||
}
|
||||
ast_channel_lock_both(c0, c1);
|
||||
c0->_bridge = c1;
|
||||
c1->_bridge = c0;
|
||||
ast_channel_unlock(c0);
|
||||
ast_channel_unlock(c1);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
@@ -7471,8 +7474,11 @@ enum ast_bridge_result ast_channel_bridge(struct ast_channel *c0, struct ast_cha
|
||||
}
|
||||
|
||||
/* Keep track of bridge */
|
||||
ast_channel_lock_both(c0, c1);
|
||||
c0->_bridge = c1;
|
||||
c1->_bridge = c0;
|
||||
ast_channel_unlock(c0);
|
||||
ast_channel_unlock(c1);
|
||||
|
||||
ast_set_owners_and_peers(c0, c1);
|
||||
|
||||
@@ -7569,8 +7575,11 @@ enum ast_bridge_result ast_channel_bridge(struct ast_channel *c0, struct ast_cha
|
||||
if (c1->_softhangup & AST_SOFTHANGUP_UNBRIDGE) {
|
||||
ast_channel_clear_softhangup(c1, AST_SOFTHANGUP_UNBRIDGE);
|
||||
}
|
||||
ast_channel_lock_both(c0, c1);
|
||||
c0->_bridge = c1;
|
||||
c1->_bridge = c0;
|
||||
ast_channel_unlock(c0);
|
||||
ast_channel_unlock(c1);
|
||||
ast_debug(1, "Unbridge signal received. Ending native bridge.\n");
|
||||
continue;
|
||||
}
|
||||
@@ -7627,8 +7636,11 @@ enum ast_bridge_result ast_channel_bridge(struct ast_channel *c0, struct ast_cha
|
||||
continue;
|
||||
}
|
||||
|
||||
ast_channel_lock_both(c0, c1);
|
||||
c0->_bridge = NULL;
|
||||
c1->_bridge = NULL;
|
||||
ast_channel_unlock(c0);
|
||||
ast_channel_unlock(c1);
|
||||
return res;
|
||||
} else {
|
||||
ast_clear_flag(c0, AST_FLAG_NBRIDGE);
|
||||
@@ -7678,8 +7690,11 @@ enum ast_bridge_result ast_channel_bridge(struct ast_channel *c0, struct ast_cha
|
||||
ast_indicate(c0, AST_CONTROL_SRCUPDATE);
|
||||
ast_indicate(c1, AST_CONTROL_SRCUPDATE);
|
||||
|
||||
ast_channel_lock_both(c0, c1);
|
||||
c0->_bridge = NULL;
|
||||
c1->_bridge = NULL;
|
||||
ast_channel_unlock(c0);
|
||||
ast_channel_unlock(c1);
|
||||
|
||||
ast_manager_event_multichan(EVENT_FLAG_CALL, "Unlink", 2, chans,
|
||||
"Channel1: %s\r\n"
|
||||
|
||||
@@ -705,7 +705,7 @@ static void *run_devstate_collector(void *data)
|
||||
static void devstate_change_collector_cb(const struct ast_event *event, void *data)
|
||||
{
|
||||
struct devstate_change *sc;
|
||||
const char *device;
|
||||
const char *device, *cachable_str;
|
||||
const struct ast_eid *eid;
|
||||
uint32_t state;
|
||||
enum ast_devstate_cache cachable = AST_DEVSTATE_CACHABLE;
|
||||
@@ -713,7 +713,6 @@ static void devstate_change_collector_cb(const struct ast_event *event, void *da
|
||||
device = ast_event_get_ie_str(event, AST_EVENT_IE_DEVICE);
|
||||
eid = ast_event_get_ie_raw(event, AST_EVENT_IE_EID);
|
||||
state = ast_event_get_ie_uint(event, AST_EVENT_IE_STATE);
|
||||
cachable = ast_event_get_ie_uint(event, AST_EVENT_IE_CACHABLE);
|
||||
|
||||
if (ast_strlen_zero(device) || !eid) {
|
||||
ast_log(LOG_ERROR, "Invalid device state change event received\n");
|
||||
@@ -726,6 +725,16 @@ static void devstate_change_collector_cb(const struct ast_event *event, void *da
|
||||
strcpy(sc->device, device);
|
||||
sc->eid = *eid;
|
||||
sc->state = state;
|
||||
|
||||
/* For 'cachable' we cannot use ast_event_get_ie_uint(), it overwrites the default of AST_DEVSTATE_CACHABLE we
|
||||
* have already setup for 'cachable', if for whatever reason the AST_EVENT_IE_CACHABLE wasn't
|
||||
* posted in the event ast_event_get_ie_uint() is going will return 0,
|
||||
* which equates to AST_DEVSTATE_NOT_CACHABLE the first enumeration in 'ast_devstate_cache'.
|
||||
*/
|
||||
|
||||
if ((cachable_str = ast_event_get_ie_str(event, AST_EVENT_IE_CACHABLE))) {
|
||||
sscanf(cachable_str, "%30u", &cachable);
|
||||
}
|
||||
sc->cachable = cachable;
|
||||
|
||||
ast_mutex_lock(&devstate_collector.lock);
|
||||
|
||||
@@ -4208,17 +4208,6 @@ int ast_bridge_call(struct ast_channel *chan, struct ast_channel *peer, struct a
|
||||
if (!f || (f->frametype == AST_FRAME_CONTROL &&
|
||||
(f->subclass.integer == AST_CONTROL_HANGUP || f->subclass.integer == AST_CONTROL_BUSY ||
|
||||
f->subclass.integer == AST_CONTROL_CONGESTION))) {
|
||||
/*
|
||||
* If the bridge was broken for a hangup that isn't real,
|
||||
* then don't run the h extension, because the channel isn't
|
||||
* really hung up. This should really only happen with AST_SOFTHANGUP_ASYNCGOTO,
|
||||
* but it doesn't hurt to check AST_SOFTHANGUP_UNBRIDGE either.
|
||||
*/
|
||||
ast_channel_lock(chan);
|
||||
if (chan->_softhangup & (AST_SOFTHANGUP_ASYNCGOTO | AST_SOFTHANGUP_UNBRIDGE)) {
|
||||
ast_set_flag(chan, AST_FLAG_BRIDGE_HANGUP_DONT);
|
||||
}
|
||||
ast_channel_unlock(chan);
|
||||
res = -1;
|
||||
break;
|
||||
}
|
||||
@@ -4404,9 +4393,17 @@ before_you_go:
|
||||
|
||||
/* run the hangup exten on the chan object IFF it was NOT involved in a parking situation
|
||||
* if it were, then chan belongs to a different thread now, and might have been hung up long
|
||||
* ago.
|
||||
* ago.
|
||||
*/
|
||||
if (ast_test_flag(&config->features_caller, AST_FEATURE_NO_H_EXTEN)) {
|
||||
if (chan->_softhangup & (AST_SOFTHANGUP_ASYNCGOTO | AST_SOFTHANGUP_UNBRIDGE)) {
|
||||
/*
|
||||
* If the bridge was broken for a hangup that isn't real,
|
||||
* then don't run the h extension, because the channel isn't
|
||||
* really hung up. This should really only happen with AST_SOFTHANGUP_ASYNCGOTO,
|
||||
* but it doesn't hurt to check AST_SOFTHANGUP_UNBRIDGE either.
|
||||
*/
|
||||
h_context = NULL;
|
||||
} else if (ast_test_flag(&config->features_caller, AST_FEATURE_NO_H_EXTEN)) {
|
||||
h_context = NULL;
|
||||
} else if (ast_exists_extension(chan, chan->context, "h", 1,
|
||||
S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL))) {
|
||||
|
||||
@@ -3280,14 +3280,15 @@ static int aji_handle_pubsub_event(void *data, ikspak *pak)
|
||||
return IKS_FILTER_EAT;
|
||||
}
|
||||
if (!strcasecmp(iks_name(item_content), "state")) {
|
||||
device_state = iks_find_cdata(item, "state");
|
||||
if ((cachable_str = iks_find_cdata(item, "cachable"))) {
|
||||
if ((cachable_str = iks_find_attrib(item_content, "cachable"))) {
|
||||
sscanf(cachable_str, "%30d", &cachable);
|
||||
}
|
||||
device_state = iks_find_cdata(item, "state");
|
||||
if (!(event = ast_event_new(AST_EVENT_DEVICE_STATE_CHANGE,
|
||||
AST_EVENT_IE_DEVICE, AST_EVENT_IE_PLTYPE_STR, item_id, AST_EVENT_IE_STATE,
|
||||
AST_EVENT_IE_PLTYPE_UINT, ast_devstate_val(device_state), AST_EVENT_IE_EID,
|
||||
AST_EVENT_IE_PLTYPE_RAW, &pubsub_eid, sizeof(pubsub_eid),
|
||||
AST_EVENT_IE_CACHABLE, AST_EVENT_IE_PLTYPE_UINT, cachable,
|
||||
AST_EVENT_IE_END))) {
|
||||
return IKS_FILTER_EAT;
|
||||
}
|
||||
|
||||
@@ -31,8 +31,10 @@
|
||||
|
||||
ASTERISK_FILE_VERSION(__FILE__, "$Revision$");
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <math.h>
|
||||
#include <sys/select.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include "asterisk/module.h"
|
||||
#include "asterisk/timing.h"
|
||||
@@ -40,7 +42,6 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$");
|
||||
#include "asterisk/astobj2.h"
|
||||
#include "asterisk/time.h"
|
||||
#include "asterisk/lock.h"
|
||||
#include "asterisk/poll-compat.h"
|
||||
|
||||
static void *timing_funcs_handle;
|
||||
|
||||
@@ -91,13 +92,15 @@ struct pthread_timer {
|
||||
unsigned int tick_count;
|
||||
unsigned int pending_ticks;
|
||||
struct timeval start;
|
||||
unsigned int continuous:1;
|
||||
bool continuous:1;
|
||||
bool pipe_signaled:1;
|
||||
};
|
||||
|
||||
static void pthread_timer_destructor(void *obj);
|
||||
static struct pthread_timer *find_timer(int handle, int unlinkobj);
|
||||
static void write_byte(struct pthread_timer *timer);
|
||||
static int read_pipe(struct pthread_timer *timer, unsigned int num);
|
||||
static void signal_pipe(struct pthread_timer *timer);
|
||||
static void unsignal_pipe(struct pthread_timer *timer);
|
||||
static void ack_ticks(struct pthread_timer *timer, unsigned int num);
|
||||
|
||||
/*!
|
||||
* \brief Data for the timing thread
|
||||
@@ -113,6 +116,7 @@ static int pthread_timer_open(void)
|
||||
{
|
||||
struct pthread_timer *timer;
|
||||
int fd;
|
||||
int i;
|
||||
|
||||
if (!(timer = ao2_alloc(sizeof(*timer), pthread_timer_destructor))) {
|
||||
errno = ENOMEM;
|
||||
@@ -127,6 +131,12 @@ static int pthread_timer_open(void)
|
||||
return -1;
|
||||
}
|
||||
|
||||
for (i = 0; i < ARRAY_LEN(timer->pipe); ++i) {
|
||||
int flags = fcntl(timer->pipe[i], F_GETFL);
|
||||
flags |= O_NONBLOCK;
|
||||
fcntl(timer->pipe[i], F_SETFL, flags);
|
||||
}
|
||||
|
||||
ao2_lock(pthread_timers);
|
||||
if (!ao2_container_count(pthread_timers)) {
|
||||
ast_mutex_lock(&timing_thread.lock);
|
||||
@@ -193,7 +203,6 @@ static int pthread_timer_set_rate(int handle, unsigned int rate)
|
||||
static int pthread_timer_ack(int handle, unsigned int quantity)
|
||||
{
|
||||
struct pthread_timer *timer;
|
||||
int res;
|
||||
|
||||
ast_assert(quantity > 0);
|
||||
|
||||
@@ -202,12 +211,12 @@ static int pthread_timer_ack(int handle, unsigned int quantity)
|
||||
}
|
||||
|
||||
ao2_lock(timer);
|
||||
res = read_pipe(timer, quantity);
|
||||
ack_ticks(timer, quantity);
|
||||
ao2_unlock(timer);
|
||||
|
||||
ao2_ref(timer, -1);
|
||||
|
||||
return res;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int pthread_timer_enable_continuous(int handle)
|
||||
@@ -221,8 +230,8 @@ static int pthread_timer_enable_continuous(int handle)
|
||||
|
||||
ao2_lock(timer);
|
||||
if (!timer->continuous) {
|
||||
timer->continuous = 1;
|
||||
write_byte(timer);
|
||||
timer->continuous = true;
|
||||
signal_pipe(timer);
|
||||
}
|
||||
ao2_unlock(timer);
|
||||
|
||||
@@ -242,13 +251,8 @@ static int pthread_timer_disable_continuous(int handle)
|
||||
|
||||
ao2_lock(timer);
|
||||
if (timer->continuous) {
|
||||
timer->continuous = 0;
|
||||
if (read_pipe(timer, 1) != 0) {
|
||||
/* Let the errno from read_pipe propagate up */
|
||||
ao2_unlock(timer);
|
||||
ao2_ref(timer, -1);
|
||||
return -1;
|
||||
}
|
||||
timer->continuous = false;
|
||||
unsignal_pipe(timer);
|
||||
}
|
||||
ao2_unlock(timer);
|
||||
|
||||
@@ -267,7 +271,7 @@ static enum ast_timer_event pthread_timer_get_event(int handle)
|
||||
}
|
||||
|
||||
ao2_lock(timer);
|
||||
if (timer->continuous && timer->pending_ticks == 1) {
|
||||
if (timer->continuous) {
|
||||
res = AST_TIMING_EVENT_CONTINUOUS;
|
||||
}
|
||||
ao2_unlock(timer);
|
||||
@@ -366,79 +370,69 @@ static int check_timer(struct pthread_timer *timer)
|
||||
/*!
|
||||
* \internal
|
||||
* \pre timer is locked
|
||||
* \retval 0 if nothing to read or read success
|
||||
* \retval -1 on error
|
||||
*/
|
||||
static int read_pipe(struct pthread_timer *timer, unsigned int quantity)
|
||||
static void ack_ticks(struct pthread_timer *timer, unsigned int quantity)
|
||||
{
|
||||
int rd_fd = timer->pipe[PIPE_READ];
|
||||
int pending_ticks = timer->pending_ticks;
|
||||
|
||||
ast_assert(quantity);
|
||||
|
||||
if (timer->continuous && pending_ticks) {
|
||||
pending_ticks--;
|
||||
}
|
||||
|
||||
if (quantity > pending_ticks) {
|
||||
quantity = pending_ticks;
|
||||
}
|
||||
|
||||
if (!quantity) {
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
|
||||
do {
|
||||
unsigned char buf[1024];
|
||||
ssize_t res;
|
||||
struct pollfd pfd = {
|
||||
.fd = rd_fd,
|
||||
.events = POLLIN,
|
||||
};
|
||||
timer->pending_ticks -= quantity;
|
||||
|
||||
if (ast_poll(&pfd, 1, 0) != 1) {
|
||||
ast_debug(1, "Reading not available on timing pipe, "
|
||||
"quantity: %u\n", quantity);
|
||||
return -1;
|
||||
}
|
||||
|
||||
res = read(rd_fd, buf,
|
||||
(quantity < sizeof(buf)) ? quantity : sizeof(buf));
|
||||
|
||||
if (res == -1) {
|
||||
if (errno == EAGAIN) {
|
||||
continue;
|
||||
}
|
||||
ast_log(LOG_ERROR, "read failed on timing pipe: %s\n",
|
||||
strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
quantity -= res;
|
||||
timer->pending_ticks -= res;
|
||||
} while (quantity);
|
||||
|
||||
return 0;
|
||||
if ((0 == timer->pending_ticks) && !timer->continuous) {
|
||||
unsignal_pipe(timer);
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
* \internal
|
||||
* \pre timer is locked
|
||||
*/
|
||||
static void write_byte(struct pthread_timer *timer)
|
||||
static void signal_pipe(struct pthread_timer *timer)
|
||||
{
|
||||
ssize_t res;
|
||||
unsigned char x = 42;
|
||||
|
||||
do {
|
||||
res = write(timer->pipe[PIPE_WRITE], &x, 1);
|
||||
} while (res == -1 && errno == EAGAIN);
|
||||
if (timer->pipe_signaled) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (res == -1) {
|
||||
res = write(timer->pipe[PIPE_WRITE], &x, 1);
|
||||
if (-1 == res) {
|
||||
ast_log(LOG_ERROR, "Error writing to timing pipe: %s\n",
|
||||
strerror(errno));
|
||||
} else {
|
||||
timer->pending_ticks++;
|
||||
timer->pipe_signaled = true;
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
* \internal
|
||||
* \pre timer is locked
|
||||
*/
|
||||
static void unsignal_pipe(struct pthread_timer *timer)
|
||||
{
|
||||
ssize_t res;
|
||||
unsigned long buffer;
|
||||
|
||||
if (!timer->pipe_signaled) {
|
||||
return;
|
||||
}
|
||||
|
||||
res = read(timer->pipe[PIPE_READ], &buffer, sizeof(buffer));
|
||||
if (-1 == res) {
|
||||
ast_log(LOG_ERROR, "Error reading from pipe: %s\n",
|
||||
strerror(errno));
|
||||
} else {
|
||||
timer->pipe_signaled = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -452,7 +446,8 @@ static int run_timer(void *obj, void *arg, int flags)
|
||||
|
||||
ao2_lock(timer);
|
||||
if (check_timer(timer)) {
|
||||
write_byte(timer);
|
||||
timer->pending_ticks++;
|
||||
signal_pipe(timer);
|
||||
}
|
||||
ao2_unlock(timer);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user