]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
move wanpipe's close function to the cross platform abstraction.
authorMichael Jerris <mike@jerris.com>
Sun, 20 May 2007 04:14:23 +0000 (04:14 +0000)
committerMichael Jerris <mike@jerris.com>
Sun, 20 May 2007 04:14:23 +0000 (04:14 +0000)
git-svn-id: http://svn.openzap.org/svn/openzap/trunk@42 a93c3328-9c30-0410-af19-c9cd2b2d52af

libs/openzap/src/include/sangoma_tdm_api.h
libs/openzap/src/zap_wanpipe.c

index 1e9c6102873bc5e83a8fc2cdfc3dd69cca0a13bb..98033bb523bea011b967aa6b5b1dba4e28ec3f8a 100644 (file)
@@ -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)
 {
index 7d5c9a8de9a4a3bdfcec09acdaa8b6d766d0c100..57c1aa740006943d8f8e008ae6f5635617874282 100644 (file)
@@ -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);
                                }
                        }
                }