Commit Graph

22 Commits

Author SHA1 Message Date
Brett Bryant 99757cdb70 Revert a previous regression in astobj2.c from merging a branch.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@123575 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-06-17 22:24:45 +00:00
Brett Bryant 2aae0ba13d Updates all usages of ast_tcptls_session_instance to be managed by reference counts so that they only get destroyed when all threads are done using
them, and memory does not get free'd causing strange issues with SIP. 

This code was originally written by russellb in the team/group/issue_11972/ branch.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@123546 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-06-17 21:46:57 +00:00
Mark Michelson b0b8bcd3b2 Put quotes around "test"
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@123541 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-06-17 21:33:40 +00:00
Mark Michelson fb3564de50 _ys pointed out in #asterisk-bugs that he was experiencing
a memory leak when running the astobj2 test CLI command. After
searching, it appears the leak was in the command handler itself.

Each object was allocated (recount = 1) and then linked into
a container (refounct = 2). Then at the end of the function, 
the container was unreffed, causing all the objects to have
their refcount decremented by one, leaving the refcount for
all objects allocated in that function at 1. I've now added
an extra unref to the mix so that the refcount equals zero
when the container is unreffed.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@123526 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-06-17 21:26:31 +00:00
Mark Michelson 6a9a22f32f Add the same fix from revision 123271 to container_destruct_debug.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@123456 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-06-17 20:19:49 +00:00
Russell Bryant 8b1646163d Merged revisions 123271 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r123271 | russell | 2008-06-17 10:48:31 -0500 (Tue, 17 Jun 2008) | 4 lines

Fix a memory leak in astobj2 that was pointed out by seanbright.  When a container
got destroyed, the underlying bucket list entry for each object that was in the
container at that time did not get free'd.

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@123272 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-06-17 15:52:13 +00:00
Steve Murphy 6138b16995 Introducing various astobj2 enhancements, chief being a refcount tracing feature, and various documentation updates in astobj2.h, and the addition of standalone utility, refcounter, that will filter the trace output for unbalanced, unfreed objects. This comes from the team/murf/bug11210 branch.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@114175 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-04-16 17:45:28 +00:00
Tilghman Lesher cfc1df4c1a Whitespace changes only
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@105840 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-03-04 23:04:29 +00:00
Russell Bryant fac7480820 Merged revisions 90348 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r90348 | russell | 2007-11-30 13:26:04 -0600 (Fri, 30 Nov 2007) | 8 lines

Change the behavior of ao2_link().  Previously, in inherited a reference.
Now, it automatically increases the reference count to reflect the reference
that is now held by the container.

This was done to be more consistent with ao2_unlink(), which automatically
releases the reference held by the container.  It also makes it so it is
no longer possible for a pointer to be invalid after ao2_link() returns.

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@90351 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-11-30 19:34:47 +00:00
Luigi Rizzo 915b97d300 move internal function declarations to include/asterisk/_private.h
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@89465 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-11-20 22:18:21 +00:00
Kevin P. Fleming edc78d6023 improve linked-list macros in two ways:
- the *_CURRENT macros no longer need the list head pointer argument
  - add AST_LIST_MOVE_CURRENT to encapsulate the remove/add operation when moving entries between lists


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@89106 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-11-08 05:28:47 +00:00
Jason Parker ebe4050128 Switch from AST_CLI (formerly NEW_CLI) to AST_CLI_DEFINE, since the former didn't make much sense
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@86820 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-10-22 20:05:18 +00:00
Jason Parker b0f3e6097e Convert NEW_CLI to AST_CLI.
Closes issue #11039, as suggested by seanbright.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@86536 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-10-19 18:29:40 +00:00
Russell Bryant e97a723cf1 Merge a ton of NEW_CLI conversions. Thanks to everyone that helped out! :)
(closes issue #10724)
Reported by: eliel
Patches: 
      chan_skinny.c.patch uploaded by eliel (license 64)
      chan_oss.c.patch uploaded by eliel (license 64)
      chan_mgcp.c.patch2 uploaded by eliel (license 64)
      pbx_config.c.patch uploaded by seanbright (license 71)
      iax2-provision.c.patch uploaded by eliel (license 64)
      chan_gtalk.c.patch uploaded by eliel (license 64)
      pbx_ael.c.patch uploaded by seanbright (license 71)
      file.c.patch uploaded by seanbright (license 71)
      image.c.patch uploaded by seanbright (license 71)
      cli.c.patch uploaded by moy (license 222)
      astobj2.c.patch uploaded by moy (license 222)
      asterisk.c.patch uploaded by moy (license 222)
      res_limit.c.patch uploaded by seanbright (license 71)
      res_convert.c.patch uploaded by seanbright (license 71)
      res_crypto.c.patch uploaded by seanbright (license 71)
      app_osplookup.c.patch uploaded by seanbright (license 71)
      app_rpt.c.patch uploaded by seanbright (license 71)
      app_mixmonitor.c.patch uploaded by seanbright (license 71)
      channel.c.patch uploaded by seanbright (license 71)
      translate.c.patch uploaded by seanbright (license 71)
      udptl.c.patch uploaded by seanbright (license 71)
      threadstorage.c.patch uploaded by seanbright (license 71)
      db.c.patch uploaded by seanbright (license 71)
      cdr.c.patch uploaded by moy (license 222)
      pbd_dundi.c.patch uploaded by moy (license 222)
      app_osplookup-rev83558.patch uploaded by moy (license 222)
      res_clioriginate.c.patch uploaded by moy (license 222)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@85460 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-10-11 19:03:06 +00:00
Russell Bryant 37dbcf6422 Merged revisions 82339 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r82339 | russell | 2007-09-13 13:57:08 -0500 (Thu, 13 Sep 2007) | 1 line

resolve a warning when not building under dev mode
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@82341 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-09-13 19:16:24 +00:00
Russell Bryant 79d79ac840 Merged revisions 82337 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r82337 | russell | 2007-09-13 13:45:59 -0500 (Thu, 13 Sep 2007) | 4 lines

Only compile in tracking astobj2 statistics if dev-mode is enabled.  Also, when
dev mode is enabled, register the CLI command that can be used to run the astobj2
test and print out statistics.

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@82338 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-09-13 18:52:35 +00:00
Steve Murphy 6cc72a0e0d Changes applied from marta's team/marta/astobj2 branch to solve a race condition
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@82124 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-09-10 16:19:45 +00:00
Luigi Rizzo 8e62c6c4d0 various changes to the documentation, and redefinition of
ao2_hash_fn and ao2_callback_fn typedefs, in preparation
to more cleanup of the _search_flags

Please do not merge this change to 1.4 yet - there are no
functional changes anyways.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@81712 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-09-06 15:43:49 +00:00
Russell Bryant 9bda1c5a94 Merged revisions 81448 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r81448 | russell | 2007-09-04 13:37:44 -0500 (Tue, 04 Sep 2007) | 4 lines

Remove the typedefs on ao2_container and ao2_iterator.  This is simply because
we don't typedef objects anywhere else in Asterisk, so we might as well make
this follow the same convention.

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@81449 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-09-04 18:40:07 +00:00
Mark Michelson 1bfe10997b Merged revisions 81426 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r81426 | mmichelson | 2007-09-01 01:02:06 -0500 (Sat, 01 Sep 2007) | 4 lines

Making match_by_addr into ao2_match_by_addr and making it available
everywhere since it could be a handy callback to have


........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@81427 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-09-01 06:03:22 +00:00
Russell Bryant 4328c75281 Merged revisions 80424 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r80424 | russell | 2007-08-22 17:40:27 -0500 (Wed, 22 Aug 2007) | 10 lines

When converting this code to use the list macros, I changed it so objects are
added to the head of a bucket instead of the tail.  However, while looking over
code with mmichelson, we noticed that the algorithm used in ao2_iterator_next
requires that items are added to the tail.  This wouldn't have caused any huge
problem, but it wasn't correct.  It meant that if an object was added to a
container while you were iterating it, and it was added to the same bucket that
the current element is in, then the new object would be returned by 
ao2_iterator_next, and any other objects in the bucket would be bypassed in
the traversal.

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@80425 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-08-22 22:43:12 +00:00
Russell Bryant 50d7fc81aa Merged revisions 80362 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r80362 | russell | 2007-08-22 15:21:36 -0500 (Wed, 22 Aug 2007) | 34 lines

Merge changes from team/russell/iax_refcount.

This set of changes fixes problems with the handling of iax2_user and iax2_peer
objects.  It was very possible for a thread to still hold a reference to one of
these objects while a reload operation tries to delete them.  The fix here is to
ensure that all references to these objects are tracked so that they can't go away
while still in use.

To accomplish this, I used the astobj2 reference counted object model.  This
code has been in one of Luigi Rizzo's branches for a long time and was primarily
developed by one of his students, Marta Carbone.  I wanted to go ahead and bring
this in to 1.4 because there are other problems similar to the ones fixed by these
changes, so we might as well go ahead and use the new astobj if we're going to go
through all of the work necessary to fix the problems.

As a nice side benefit of these changes, peer and user handling got more efficient.
Using astobj2 lets us not hold the container lock for peers or users nearly as long
while iterating.  Also, by changing a define at the top of chan_iax2.c, the objects
will be distributed in a hash table, drastically increasing lookup speed in these
containers, which will have a very big impact on systems that have a large number of
users or peers.

The use of the hash table will be made the default in trunk.  It is not the default
in 1.4 because it changes the behavior slightly.  Previously, since peers and users
were stored in memory in the same order they were specified in the configuration file,
you could influence peer and user matching order based on the order they are specified
in the configuration.  The hash table does not guarantee any order in the container,
so this behavior will be going away.  It just means that you have to be a little
more careful ensuring that peers and users are matched explicitly and not forcing
chan_iax2 to have to guess which user is the right one based on secret, host, and
access list settings, instead of simply using the username.

If you have any questions, feel free to ask on the asterisk-dev list.

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@80387 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-08-22 20:44:23 +00:00