* Remove extraneous whitespace
* Bump up debug levels of messages and add identifying info to messages.
* Account for potential failures of ao2_link()
* Add additional test and some more test data
* Add some comments in places where they could be useful
* Make threadpool listeners and their callbacks optional
git-svn-id: https://origsvn.digium.com/svn/asterisk/team/mmichelson/threadpool@378652 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Unfortunately, this required a taskprocessor listener change that makes listener allocation
utterly silly. I'm going to change the scheme so that allocation of taskprocessor listeners
is done internally within taskprocessor code. This will make it parallel with threadpool
code, which is a good thing.
git-svn-id: https://origsvn.digium.com/svn/asterisk/team/mmichelson/threadpool@377687 65c4cc65-6c06-0410-ace0-fbb531ad65f3
The only test added so far is an idle thread timeout
option. This will greatly aid threadpool users who wish
to maintain a threadpool by allowing for idle threads to
die out as necessary.
Test passes.
git-svn-id: https://origsvn.digium.com/svn/asterisk/team/mmichelson/threadpool@377580 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This helps tests to pass more often than before.
They are far less likely to queue extra processes
into the control taskprocessor since they are prevented
once the threadpool begins to shut down.
git-svn-id: https://origsvn.digium.com/svn/asterisk/team/mmichelson/threadpool@377578 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This one involves shrinking the threadpool in such
a way that both idle and active threads are affected.
This test made me re-realize why the zombie state exists,
so I re-added it. We don't want to clog up the control
taskprocessor by waiting on active threads to complete
what they are doing. Instead, we mark them as zombies so
that when they are done, they can clean themselves up
properly.
Without the zombie state available, the new test actually
will deadlock.
git-svn-id: https://origsvn.digium.com/svn/asterisk/team/mmichelson/threadpool@377474 65c4cc65-6c06-0410-ace0-fbb531ad65f3
The new thread creation test fails because Asterisk locks up
while trying to lock a taskprocessor.
While trying to debug that, I found a race condition during taskprocessor
creation where a default taskprocessor listener could try to operate on
a partially started taskprocessor. This was fixed by adding a new callback
to taskprocessor listeners.
Then while testing that change, I found some bugs in the taskprocessor
tests where I was not properly unlocking when done with a lock. Scoped
locks have spoiled me a bit.
I still have not figured out why the threadpool thread creation test
is locking up.
git-svn-id: https://origsvn.digium.com/svn/asterisk/team/mmichelson/threadpool@377368 65c4cc65-6c06-0410-ace0-fbb531ad65f3
file:///srv/subversion/repos/asterisk/trunk
........
r376575 | rmudgett | 2012-11-21 12:33:16 -0600 (Wed, 21 Nov 2012) | 20 lines
Add red-black tree container type to astobj2.
* Add red-black tree container type.
* Add CLI command "astobj2 container dump <name>"
* Added ao2_container_dump() so the container could be dumped by other
modules for debugging purposes.
* Changed ao2_container_stats() so it can be used by other modules like
ao2_container_check() for debugging purposes.
* Updated the unit tests to check red-black tree containers.
(closes issue ASTERISK-19970)
Reported by: rmudgett
Tested by: rmudgett
Review: https://reviewboard.asterisk.org/r/2110/
........
git-svn-id: https://origsvn.digium.com/svn/asterisk/team/mmichelson/threadpool@376580 65c4cc65-6c06-0410-ace0-fbb531ad65f3
file:///srv/subversion/repos/asterisk/trunk
........
r376457 | mjordan | 2012-11-18 20:14:54 -0600 (Sun, 18 Nov 2012) | 7 lines
Fix uninitialized in this function error
With some versions of gcc, n_buckets will be flagged as being uninitialized
before use. While its technically impossible (since the switch statement,
even without a default, accounts for all possibilities), we'll initialize the
variable to 0 anyway.
........
git-svn-id: https://origsvn.digium.com/svn/asterisk/team/mmichelson/threadpool@376462 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This helps account for the fact that it is unknown just
how many references may exist for a given taskprocessor
listener, so simply unreffing it from the taskprocessor
shutdown function is not enough to convey the gravity
of the situation.
By putting in a shutdown callback, it now becomes clear
to the listener not to try to do any further operations
on the taskprocessor.
git-svn-id: https://origsvn.digium.com/svn/asterisk/team/mmichelson/threadpool@376381 65c4cc65-6c06-0410-ace0-fbb531ad65f3
file:///srv/subversion/repos/asterisk/trunk
................
r376341 | dlee | 2012-11-15 18:08:00 -0600 (Thu, 15 Nov 2012) | 34 lines
Migrate hashtest/hashtest2 to be unit tests.
Both hashtest and hashtest2 are manual testing apps that thrash hash
tables (hashtab and ao2 containers, respectively), by spinning up
several threads that randomly insert, delete, lookup and iterate over
the hash table. If the app doesn't crash, the hash table probably passes
the test. Those utils are not a part of the typical Asterisk build, so
they do not usually get compiled. This all makes them less that useful.
This patch removes those manual test programs and replaces them with
Asterisk unit test modules (test_{hashtab,astobj2}_thrash.so). It also
attempts to make the tests more deterministic.
* Rather than spinning up some number of threads that operate on the
hash table randomly, spin up four threads that concurrenly add,
remove, lookup and iterate over the hash table.
* Each thread checks the state of the hash table both during and after
execution, and indicates a test failure if things are not as expected.
* Each thread times out after 60 seconds to prevent deadlocking the unit
test run.
(closes issue ASTERISK-20505)
Reported by: Matt Jordan
Review: https://reviewboard.asterisk.org/r/2189/
........
Merged revisions 376306 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........
Merged revisions 376315 from http://svn.asterisk.org/svn/asterisk/branches/10
........
Merged revisions 376339 from http://svn.asterisk.org/svn/asterisk/branches/11
................
r376344 | dlee | 2012-11-15 18:14:00 -0600 (Thu, 15 Nov 2012) | 1 line
Somehow I put in svn-1.6 merge information. Oops.
................
r376345 | dlee | 2012-11-15 18:15:30 -0600 (Thu, 15 Nov 2012) | 15 lines
Fixed extconf.c breakage introduced in r376306.
To quote wdoekes:
> Note that I'm not confirming legitimacy of having that file in tree at
> all. Is anyone using aelparse/conf2ael?
........
Merged revisions 376340 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........
Merged revisions 376342 from http://svn.asterisk.org/svn/asterisk/branches/10
........
Merged revisions 376343 from http://svn.asterisk.org/svn/asterisk/branches/11
................
git-svn-id: https://origsvn.digium.com/svn/asterisk/team/mmichelson/threadpool@376352 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Update title that was left behind many years ago. Used revision 6596 as my guide for what it should be.
(issue ASTERISK-20259)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@375007 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Greenlight in #asterisk brought up that he was receiving an error message "Could
not create persistent member string, out of space" when running app_queue in
Asterisk 10. dump_queue_members() made an assumption that 8K would be enough to
store the generated string, but with queues that have large member lists this is
not always the case. This patch removes the limitation and uses ast_str instead
of a fixed sized buffer.
The complicating factor comes from the fact that ast_db_get requires a buffer
and buffer size argument, which doesn't let us pull back more than what we pass
in, so I introduced a new ast_db_get_allocated() which returns an ast_strdup()'d
copy of the value from astdb.
As an aside, I did some testing on the maximum size of data that we can store in
the BDB library we distribute and was able to store a 10MB string and retrieve
it with no problems, so I feel this is a safe patch.
Review: https://reviewboard.asterisk.org/r/2136/
........
Merged revisions 374108 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........
Merged revisions 374135 from http://svn.asterisk.org/svn/asterisk/branches/10
........
Merged revisions 374150 from http://svn.asterisk.org/svn/asterisk/branches/11
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374151 65c4cc65-6c06-0410-ace0-fbb531ad65f3
* Whitespace, doc-blocks, spelling, case, missing and incorrect tags.
* Add cleanup to Makefile for the Doxygen configuration update
* Start updating Doxygen configuration for cleaner output
* Enable inclusion of configuration files into documentation
* remove mantisworkflow...
* update documentation README
* Add markup to Tilghman's email and talk with him about updating his email, he knows...
* no code changes on this commit other than the mentioned Makefile change
(issue ASTERISK-20259)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@373384 65c4cc65-6c06-0410-ace0-fbb531ad65f3
The new API allows for sorted containers, insertion options, duplicate
handling options, and traversal order options.
* Adds the ability for containers to be sorted when they are created.
* Adds container creation options to handle duplicates when they are
inserted.
* Adds container creation option to insert objects at the beginning or end
of the container traversal order.
* Adds OBJ_PARTIAL_KEY to allow searching with a partial key. The partial
key works similarly to the OBJ_KEY flag. (The real search speed
improvement with this flag will come when red-black trees are added.)
* Adds container traversal and iteration order options: Ascending and
Descending.
* Adds an AST_DEVMODE compile feature to check the stats and integrity of
registered containers using the CLI "astobj2 container stats <name>" and
"astobj2 container check <name>". The channels container is normally
registered since it is one of the most important containers in the system.
* Adds ao2_iterator_restart() to allow iteration to be restarted from the
beginning.
* Changes the generic container object to have a v_method table pointer to
support other types of containers.
* Changes the container nodes holding objects to be ref counted.
The ref counted nodes and v_method table pointer changes pave the way to
allow other types of containers.
* Includes a large astobj2 unit test enhancement that tests the new
features.
(closes issue ASTERISK-19969)
Reported by: rmudgett
Review: https://reviewboard.asterisk.org/r/2078/
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@372997 65c4cc65-6c06-0410-ace0-fbb531ad65f3
One of my recent commits broke this test. The error was:
[test_event.c:event_new_test:214]: Events expected to be identical
have different size: 69 != 59
The difference in size occurred because the first event had
the EID IE added to the event twice. ast_event_new() now always
adds it automatically. Previously it only added it if there
were no IEs specified, which was kind of weird.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@370541 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Revision 370426 introduced the use of a nested function in tests/test_acl.c,
but the lack of the 'auto' scope specifier on the function and a forward
declaration resulted in compilation errors on the automated test systems.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@370453 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Rules in ACLs (specified using 'permit' and 'deny') can now contain multiple
items (separated by commas), and items in the rule can be negated by prefixing
them with '!'. This simplifies Asterisk Realtime configurations, since it is no
longer necessray to control the order that the 'permit' and 'deny' columns are
returned from queries.
Review: https://reviewboard.asterisk.org/r/1592/
Initial patch contributed by Tilghman Lesher
Unit tests written by Kevin P. Fleming
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@370426 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This patch includes the following:
* Unit tests for the abstract Jitter Buffer API. This includes both fixed
and adaptive flavors, testing nominal creation, frame input, frame retrieval,
resyncing; off nominal frame input overflow, out of order, and others.
* Tweaks to the abstract_jb API to remove the unnecessary resync_threshold
parameter from the create function (resync_threshold is already in the
struct passed into the create function)
* Ensure the fixed jitter buffer is empty before destroying it, to avoid an
ASSERT
* Don't "resync" the adaptive jitter buffer. The mechanism that was being
used actually causes the jitter buffer to think its being overflowed by going
around the jitterbuf API and attempting to 'resynch' it improperly. If a
resync is needed, the jitter buffer will do it properly by itself. Note that
this is only an optimization needed for trunk, as the worst that happens is
the loss of three voice packets before the adaptive jitter buffer will resync
anyway.
Review: https://reviewboard.asterisk.org/r/2035
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@370387 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Allows the setting of flags via the config options api.
For example, code like this:
#define OPT1 1 << 0
#define OPT2 1 << 1
#define OPT3 1 << 2
struct thing {
unsigned int flags;
};
and a config like this:
[blah]
opt1=yes
opt2=no
opt3=yes
Review: https://reviewboard.asterisk.org/r/2004/
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@369454 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Added documentation describing what flags and arguments to pass to
aco_option_register for default option types. Also changed the ACL
handler to use the flags parameter to differentiate between "permit"
and "deny" instead of adding an additional vararg parameter.
Review: https://reviewboard.asterisk.org/r/1969/
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@368663 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Presence support has been added. This is accomplished by
allowing for presence hints in addition to device state
hints. A dialplan function called PRESENCE_STATE has been
added to allow for setting and reading presence. Presence
can be transmitted to Digium phones using custom XML
elements in a PIDF presence document.
Voicemail has new APIs that allow for moving, removing,
forwarding, and playing messages. Messages have had a new
unique message ID added to them so that the APIs will work
reliably. The state of a voicemail mailbox can be obtained
using an API that allows one to get a snapshot of the mailbox.
A voicemail Dialplan App called VoiceMailPlayMsg has been
added to be able to play back a specific message.
Configuration hooks have been added. Configuration hooks
allow for a piece of code to be executed when a specific
configuration file is loaded by a specific module. This is
useful for modules that are dependent on the configuration
of other modules.
chan_sip now has a public method that allows for a custom
SIP INFO request to be sent mid-dialog. Digium phones use
this in order to display progress bars when files are played.
Messaging support has been expanded a bit. The main
visible difference is the addition of an AMI action
MessageSend.
Finally, a ParkingLots manager action has been added in order
to get a list of parking lots.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@368435 65c4cc65-6c06-0410-ace0-fbb531ad65f3