On Wed, 15 Feb 2006, Bartek Kania wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Just noticed that musiconhold didn't deactivate a generator that was
> already running on a channel and then started it's own.
> Since it seems like this is something that might happen, and is
> probably happening in other parts of the code I suggest the following
> addition to the opbx_generator_activate function:
>
> /* If a generator is already active on the channel, * stop it */
> if (pgcd->gen_is_active) {
> opbx_log(LOG_WARNING, "Generator was already active on"
> "channel %s when starting a new one!\n",
> chan->name);
> opbx_generator_deactivate(chan);
> }
>
> This would stop any running generators and print a warning each time a
> new one is started on the channel.
>
> So my question is if this is a good thing? Is there ever a legitimate
> reason not to stop a running generator when starting a new one?
> My limited testing has uncovered no problems so far, but then the
> testing was pretty basic.
> So should I commit this to trunk, or does anyone have objections to
> it?
I don't think it is necessary to do that at all. The generator thread will
deactivate any running generator by itself when it receives a new request.
Have a look at the static void *opbx_generator_thread(void *data) function:
...
if (res || pgcd->gen_req) {
/* Got generator error or new
* request. Deactivate current
* generator */
if (!pgcd->gen_req) {
opbx_log(LOG_DEBUG, "Generator
self-deactivating\n");
pgcd->gen_req = gen_req_deactivate;
}
break;
}
...
If this doesn't work as expected, then it should be fixed here instead of
another deactivation call somewhere else in the code.
Armin
_______________________________________________
Openpbx-dev mailing list
[email protected]
http://lists.openpbx.org/mailman/listinfo/openpbx-dev