[asterisk-dev] [Code Review] handle DAHDI_EVENT_REMOVED on a D-Channel
Tzafrir Cohen
tzafrir.cohen at xorcom.com
Wed Jul 7 14:22:34 CDT 2010
> On 2010-06-18 11:59:49, Jeff Peeler wrote:
> > /trunk/channels/chan_dahdi.c, line 13782
> > <https://reviewboard.asterisk.org/r/726/diff/1/?file=10913#file10913line13782>
> >
> > I don't think issuing a pthread_cancel will terminate the thread immediately, you must join before you can safely start closing fds. See how dahdi_restart is done.
Done.
> On 2010-06-18 11:59:49, Jeff Peeler wrote:
> > /trunk/channels/chan_dahdi.c, line 13789
> > <https://reviewboard.asterisk.org/r/726/diff/1/?file=10913#file10913line13789>
> >
> > I can't see why anyone would want to shut down the span, but keep the associated b-channels. At this point you could just lock the iflock and call destroy_channel on every dahdi_pvt via the sig_pri_chan pvts.
I noticed that there were some extra cleanups done before that by the CC code, so I ended up calling dahdi_destroy_channel_bynum for that. I suspect most of it, if at all, is not needed. But at least until I resolve https://issues.asterisk.org/view.php?id=17588 I prefer sticking with the same code path as 'dahdi destroy channel'
- Tzafrir
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/726/#review2232
-----------------------------------------------------------
On 2010-07-07 14:22:28, Tzafrir Cohen wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/726/
> -----------------------------------------------------------
>
> (Updated 2010-07-07 14:22:28)
>
>
> Review request for Asterisk Developers and rmudgett.
>
>
> Summary
> -------
>
> When a DAHDI device is removed at run-time it sends the event DAHDI_EVENT_REMOVED on each channel. This is intended to signal the userspace program to close the respective file handle, as the driver of the device will need all of them closed to properly clean-up.
>
> This event has long since been handled in chan_dahdi (chan_zap at the time). However the event that is sent on a D-Channel of a "PRI" (ISDN) span simply gets ignored.
>
> This code adds handling for closing the file descriptor (and shutting down the span, while we're at it).
>
> It also adds a CLI command 'pri destroy span <N>' to destroy the span and its DAHDI channels.
>
> This code seems to be rather DAHDI-generic and thus I opted not to change anything in sig_pri.c .
>
> I use a simplified version of the container_of() macro from the Linux Kernel, which basically returns a pointer to a struct that contains a different struct to which we already have a pointer. Thus I assume this will always be run with on a struct sig_pri_pri that is contained ina s struct dahdi_pri .
>
> I'm not sure what proper locking needs doing.
>
>
> Diffs
> -----
>
> /trunk/channels/chan_dahdi.c 274090
>
> Diff: https://reviewboard.asterisk.org/r/726/diff
>
>
> Testing
> -------
>
> Disconnecting either using the CLI command or with device removal for some E1 and some BRI devices.
>
>
> Thanks,
>
> Tzafrir
>
>
More information about the asterisk-dev
mailing list