move wanpipe's close function to the cross platform abstraction.
git-svn-id: http://svn.openzap.org/svn/openzap/trunk@42 a93c3328-9c30-0410-af19-c9cd2b2d52af
This commit is contained in:
parent
426739b6b9
commit
6424510af9
|
@ -146,6 +146,18 @@ static sng_fd_t tdmv_api_open_span_chan(int span, int chan)
|
|||
#endif
|
||||
}
|
||||
|
||||
void tdmv_api_close_socket(sng_fd_t *sp)
|
||||
{
|
||||
if( *sp != INVALID_HANDLE_VALUE){
|
||||
#if defined(__WINDOWS__)
|
||||
CloseHandle(*sp);
|
||||
#else
|
||||
close(*sp);
|
||||
#endif
|
||||
*sp = INVALID_HANDLE_VALUE;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef __WINDOWS__
|
||||
static int wanpipe_api_ioctl(sng_fd_t fd, wan_cmd_api_t *api_cmd)
|
||||
{
|
||||
|
|
|
@ -621,12 +621,6 @@ zap_status_t wanpipe_init(zap_software_interface_t **zint)
|
|||
return ZAP_SUCCESS;
|
||||
}
|
||||
|
||||
#if defined(__WINDOWS__)
|
||||
#define close(handle) CloseHandle(handle)
|
||||
#endif
|
||||
|
||||
#define zap_wanpipe_socket_close(it) if (it != WP_INVALID_SOCKET) { close(it); it = WP_INVALID_SOCKET;}
|
||||
|
||||
zap_status_t wanpipe_destroy(void)
|
||||
{
|
||||
unsigned int i,j;
|
||||
|
@ -639,7 +633,7 @@ zap_status_t wanpipe_destroy(void)
|
|||
zap_channel_t *cur_chan = &cur_span->channels[j];
|
||||
if (zap_test_flag(cur_chan, ZAP_CHANNEL_CONFIGURED)) {
|
||||
zap_log(ZAP_LOG_INFO, "Closing channel %u:%u fd:%d\n", cur_chan->span_id, cur_chan->chan_id, cur_chan->sockfd);
|
||||
zap_wanpipe_socket_close(cur_chan->sockfd);
|
||||
tdmv_api_close_socket(cur_chan->sockfd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue