From 7faf9f4c25420204b53b5bbda1d228536778b39b Mon Sep 17 00:00:00 2001 From: Peter Olsson Date: Sat, 18 Oct 2014 09:53:57 +0200 Subject: [PATCH] FS-6767 #comment Add initial support for mod_verto on Windows --- Freeswitch.2012.sln | 61 ++++++++ src/mod/codecs/mod_vp8/mod_vp8.2012.vcxproj | 135 ++++++++++++++++++ .../endpoints/mod_rtc/mod_rtc.2012.vcxproj | 135 ++++++++++++++++++ src/mod/endpoints/mod_verto/mcast/mcast.c | 8 ++ src/mod/endpoints/mod_verto/mcast/mcast.h | 20 +++ .../endpoints/mod_verto/mcast/mcast_cpp.cpp | 2 + .../mod_verto/mod_verto.2012.vcxproj | 27 +++- src/mod/endpoints/mod_verto/mod_verto.c | 50 +++++-- src/mod/endpoints/mod_verto/mod_verto.h | 18 ++- src/mod/endpoints/mod_verto/ws.c | 4 + src/mod/endpoints/mod_verto/ws.h | 10 +- 11 files changed, 447 insertions(+), 23 deletions(-) create mode 100644 src/mod/codecs/mod_vp8/mod_vp8.2012.vcxproj create mode 100644 src/mod/endpoints/mod_rtc/mod_rtc.2012.vcxproj diff --git a/Freeswitch.2012.sln b/Freeswitch.2012.sln index 7d97a01985..ff675f6ab1 100644 --- a/Freeswitch.2012.sln +++ b/Freeswitch.2012.sln @@ -603,6 +603,12 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Download LDNS", "libs\win32 EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Download PORTAUDIO", "libs\win32\Download PORTAUDIO.2012.vcxproj", "{C0779BCC-C037-4F58-B890-EF37BA956B3C}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_vp8", "src\mod\codecs\mod_vp8\mod_vp8.2012.vcxproj", "{ABFD88E1-7710-4BCC-AC34-56038DAC9652}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_rtc", "src\mod\endpoints\mod_rtc\mod_rtc.2012.vcxproj", "{3884ADD2-91D0-4CD6-86D3-D5FB2D4AAB9E}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_verto", "src\mod\endpoints\mod_verto\mod_verto.2012.vcxproj", "{5B2BACE4-0F5A-4A21-930D-C0F4B1F58FA6}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution All|Win32 = All|Win32 @@ -4043,6 +4049,58 @@ Global {C0779BCC-C037-4F58-B890-EF37BA956B3C}.Release|x64.Build.0 = Release|Win32 {C0779BCC-C037-4F58-B890-EF37BA956B3C}.Release|x64 Setup.ActiveCfg = Release|Win32 {C0779BCC-C037-4F58-B890-EF37BA956B3C}.Release|x86 Setup.ActiveCfg = Release|Win32 + {ABFD88E1-7710-4BCC-AC34-56038DAC9652}.All|Win32.ActiveCfg = Release|Win32 + {ABFD88E1-7710-4BCC-AC34-56038DAC9652}.All|Win32.Build.0 = Release|Win32 + {ABFD88E1-7710-4BCC-AC34-56038DAC9652}.All|x64.ActiveCfg = Release|x64 + {ABFD88E1-7710-4BCC-AC34-56038DAC9652}.All|x64.Build.0 = Release|x64 + {ABFD88E1-7710-4BCC-AC34-56038DAC9652}.All|x64 Setup.ActiveCfg = Release|Win32 + {ABFD88E1-7710-4BCC-AC34-56038DAC9652}.All|x86 Setup.ActiveCfg = Release|Win32 + {ABFD88E1-7710-4BCC-AC34-56038DAC9652}.Debug|Win32.ActiveCfg = Debug|Win32 + {ABFD88E1-7710-4BCC-AC34-56038DAC9652}.Debug|Win32.Build.0 = Debug|Win32 + {ABFD88E1-7710-4BCC-AC34-56038DAC9652}.Debug|x64.ActiveCfg = Debug|x64 + {ABFD88E1-7710-4BCC-AC34-56038DAC9652}.Debug|x64.Build.0 = Debug|x64 + {ABFD88E1-7710-4BCC-AC34-56038DAC9652}.Debug|x64 Setup.ActiveCfg = Debug|Win32 + {ABFD88E1-7710-4BCC-AC34-56038DAC9652}.Debug|x86 Setup.ActiveCfg = Debug|Win32 + {ABFD88E1-7710-4BCC-AC34-56038DAC9652}.Release|Win32.ActiveCfg = Release|Win32 + {ABFD88E1-7710-4BCC-AC34-56038DAC9652}.Release|Win32.Build.0 = Release|Win32 + {ABFD88E1-7710-4BCC-AC34-56038DAC9652}.Release|x64.ActiveCfg = Release|x64 + {ABFD88E1-7710-4BCC-AC34-56038DAC9652}.Release|x64.Build.0 = Release|x64 + {ABFD88E1-7710-4BCC-AC34-56038DAC9652}.Release|x64 Setup.ActiveCfg = Release|Win32 + {ABFD88E1-7710-4BCC-AC34-56038DAC9652}.Release|x86 Setup.ActiveCfg = Release|Win32 + {3884ADD2-91D0-4CD6-86D3-D5FB2D4AAB9E}.All|Win32.ActiveCfg = Release|x64 + {3884ADD2-91D0-4CD6-86D3-D5FB2D4AAB9E}.All|x64.ActiveCfg = Release|x64 + {3884ADD2-91D0-4CD6-86D3-D5FB2D4AAB9E}.All|x64.Build.0 = Release|x64 + {3884ADD2-91D0-4CD6-86D3-D5FB2D4AAB9E}.All|x64 Setup.ActiveCfg = Release|x64 + {3884ADD2-91D0-4CD6-86D3-D5FB2D4AAB9E}.All|x86 Setup.ActiveCfg = Release|x64 + {3884ADD2-91D0-4CD6-86D3-D5FB2D4AAB9E}.Debug|Win32.ActiveCfg = Debug|Win32 + {3884ADD2-91D0-4CD6-86D3-D5FB2D4AAB9E}.Debug|Win32.Build.0 = Debug|Win32 + {3884ADD2-91D0-4CD6-86D3-D5FB2D4AAB9E}.Debug|x64.ActiveCfg = Debug|x64 + {3884ADD2-91D0-4CD6-86D3-D5FB2D4AAB9E}.Debug|x64.Build.0 = Debug|x64 + {3884ADD2-91D0-4CD6-86D3-D5FB2D4AAB9E}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {3884ADD2-91D0-4CD6-86D3-D5FB2D4AAB9E}.Debug|x86 Setup.ActiveCfg = Debug|x64 + {3884ADD2-91D0-4CD6-86D3-D5FB2D4AAB9E}.Release|Win32.ActiveCfg = Release|Win32 + {3884ADD2-91D0-4CD6-86D3-D5FB2D4AAB9E}.Release|Win32.Build.0 = Release|Win32 + {3884ADD2-91D0-4CD6-86D3-D5FB2D4AAB9E}.Release|x64.ActiveCfg = Release|x64 + {3884ADD2-91D0-4CD6-86D3-D5FB2D4AAB9E}.Release|x64.Build.0 = Release|x64 + {3884ADD2-91D0-4CD6-86D3-D5FB2D4AAB9E}.Release|x64 Setup.ActiveCfg = Release|x64 + {3884ADD2-91D0-4CD6-86D3-D5FB2D4AAB9E}.Release|x86 Setup.ActiveCfg = Release|x64 + {5B2BACE4-0F5A-4A21-930D-C0F4B1F58FA6}.All|Win32.ActiveCfg = Release|x64 + {5B2BACE4-0F5A-4A21-930D-C0F4B1F58FA6}.All|x64.ActiveCfg = Release|x64 + {5B2BACE4-0F5A-4A21-930D-C0F4B1F58FA6}.All|x64.Build.0 = Release|x64 + {5B2BACE4-0F5A-4A21-930D-C0F4B1F58FA6}.All|x64 Setup.ActiveCfg = Release|x64 + {5B2BACE4-0F5A-4A21-930D-C0F4B1F58FA6}.All|x86 Setup.ActiveCfg = Release|x64 + {5B2BACE4-0F5A-4A21-930D-C0F4B1F58FA6}.Debug|Win32.ActiveCfg = Debug|Win32 + {5B2BACE4-0F5A-4A21-930D-C0F4B1F58FA6}.Debug|Win32.Build.0 = Debug|Win32 + {5B2BACE4-0F5A-4A21-930D-C0F4B1F58FA6}.Debug|x64.ActiveCfg = Debug|x64 + {5B2BACE4-0F5A-4A21-930D-C0F4B1F58FA6}.Debug|x64.Build.0 = Debug|x64 + {5B2BACE4-0F5A-4A21-930D-C0F4B1F58FA6}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {5B2BACE4-0F5A-4A21-930D-C0F4B1F58FA6}.Debug|x86 Setup.ActiveCfg = Debug|x64 + {5B2BACE4-0F5A-4A21-930D-C0F4B1F58FA6}.Release|Win32.ActiveCfg = Release|Win32 + {5B2BACE4-0F5A-4A21-930D-C0F4B1F58FA6}.Release|Win32.Build.0 = Release|Win32 + {5B2BACE4-0F5A-4A21-930D-C0F4B1F58FA6}.Release|x64.ActiveCfg = Release|x64 + {5B2BACE4-0F5A-4A21-930D-C0F4B1F58FA6}.Release|x64.Build.0 = Release|x64 + {5B2BACE4-0F5A-4A21-930D-C0F4B1F58FA6}.Release|x64 Setup.ActiveCfg = Release|x64 + {5B2BACE4-0F5A-4A21-930D-C0F4B1F58FA6}.Release|x86 Setup.ActiveCfg = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -4059,6 +4117,7 @@ Global {4D418176-3B33-47E6-A63E-01BA34ADD21C} = {F881ADA2-2F1A-4046-9FEB-191D9422D781} {AFA983D6-4569-4F88-BA94-555ED00FD9A8} = {F881ADA2-2F1A-4046-9FEB-191D9422D781} {64E99CCA-3C6F-4AEB-9FA3-CFAC711257BB} = {F881ADA2-2F1A-4046-9FEB-191D9422D781} + {ABFD88E1-7710-4BCC-AC34-56038DAC9652} = {F881ADA2-2F1A-4046-9FEB-191D9422D781} {5FD31A25-5D83-4794-8BEE-904DAD84CE71} = {9460B5F1-0A95-41C4-BEB7-9C2C96459A7C} {FFAA4C52-3A53-4F99-90C1-D59D1F0427F3} = {9460B5F1-0A95-41C4-BEB7-9C2C96459A7C} {0DF3ABD0-DDC0-4265-B778-07C66780979B} = {9460B5F1-0A95-41C4-BEB7-9C2C96459A7C} @@ -4069,6 +4128,8 @@ Global {C6E78A4C-DB1E-47F4-9B63-4DC27D86343F} = {9460B5F1-0A95-41C4-BEB7-9C2C96459A7C} {05C9FB27-480E-4D53-B3B7-7338E2514666} = {9460B5F1-0A95-41C4-BEB7-9C2C96459A7C} {74B120FF-6935-4DFE-A142-CDB6BEA99C90} = {9460B5F1-0A95-41C4-BEB7-9C2C96459A7C} + {3884ADD2-91D0-4CD6-86D3-D5FB2D4AAB9E} = {9460B5F1-0A95-41C4-BEB7-9C2C96459A7C} + {5B2BACE4-0F5A-4A21-930D-C0F4B1F58FA6} = {9460B5F1-0A95-41C4-BEB7-9C2C96459A7C} {30A5B29C-983E-4580-9FD0-D647CCDCC7EB} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78} {B69247FA-ECD6-40ED-8E44-5CA6C3BAF9A4} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78} {C24FB505-05D7-4319-8485-7540B44C8603} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78} diff --git a/src/mod/codecs/mod_vp8/mod_vp8.2012.vcxproj b/src/mod/codecs/mod_vp8/mod_vp8.2012.vcxproj new file mode 100644 index 0000000000..8177bd67fa --- /dev/null +++ b/src/mod/codecs/mod_vp8/mod_vp8.2012.vcxproj @@ -0,0 +1,135 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + mod_vp8 + {ABFD88E1-7710-4BCC-AC34-56038DAC9652} + mod_vp8 + Win32Proj + + + + DynamicLibrary + MultiByte + v110 + + + DynamicLibrary + MultiByte + v110 + + + DynamicLibrary + MultiByte + v110 + + + DynamicLibrary + MultiByte + v110 + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + + + + + + + + false + + + + + + + X64 + + + + + + + false + + + MachineX64 + + + + + + + + + false + + + + + + + X64 + + + + + + + false + + + MachineX64 + + + + + + + + {202d7a4e-760d-4d0e-afa1-d7459ced30ff} + false + + + + + + diff --git a/src/mod/endpoints/mod_rtc/mod_rtc.2012.vcxproj b/src/mod/endpoints/mod_rtc/mod_rtc.2012.vcxproj new file mode 100644 index 0000000000..3a65e7bb7a --- /dev/null +++ b/src/mod/endpoints/mod_rtc/mod_rtc.2012.vcxproj @@ -0,0 +1,135 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + mod_rtc + {3884ADD2-91D0-4CD6-86D3-D5FB2D4AAB9E} + mod_rtc + Win32Proj + + + + DynamicLibrary + MultiByte + v110 + + + DynamicLibrary + MultiByte + v110 + + + DynamicLibrary + MultiByte + v110 + + + DynamicLibrary + MultiByte + v110 + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + + + + + + + + false + + + + + + + X64 + + + + + + + false + + + MachineX64 + + + + + + + + + false + + + + + + + X64 + + + + + + + false + + + MachineX64 + + + + + + + + {202d7a4e-760d-4d0e-afa1-d7459ced30ff} + false + + + + + + diff --git a/src/mod/endpoints/mod_verto/mcast/mcast.c b/src/mod/endpoints/mod_verto/mcast/mcast.c index 9a2371b8ce..978c3dc6a5 100644 --- a/src/mod/endpoints/mod_verto/mcast/mcast.c +++ b/src/mod/endpoints/mod_verto/mcast/mcast.c @@ -37,13 +37,21 @@ #include #include #include +#ifdef WIN32 +#include +#else #include #include #include +#endif #include +#ifndef WIN32 #include +#endif #include "mcast.h" +#ifndef WIN32 #include +#endif #include int mcast_socket_create(const char *host, int16_t port, mcast_handle_t *handle, mcast_flag_t flags) diff --git a/src/mod/endpoints/mod_verto/mcast/mcast.h b/src/mod/endpoints/mod_verto/mcast/mcast.h index 38afa951e9..915f803fe8 100644 --- a/src/mod/endpoints/mod_verto/mcast/mcast.h +++ b/src/mod/endpoints/mod_verto/mcast/mcast.h @@ -42,9 +42,29 @@ extern "C" { #endif #include +#ifdef WIN32 +#include +#else #include #include #include +#endif + +#ifdef _MSC_VER +#include +#ifndef strncasecmp +#define strncasecmp _strnicmp +#endif +#define snprintf _snprintf +#ifdef _WIN64 +#define WS_SSIZE_T __int64 +#elif _MSC_VER >= 1400 +#define WS_SSIZE_T __int32 __w64 +#else +#define WS_SSIZE_T __int32 +#endif +typedef WS_SSIZE_T ssize_t; +#endif typedef struct { int sock; diff --git a/src/mod/endpoints/mod_verto/mcast/mcast_cpp.cpp b/src/mod/endpoints/mod_verto/mcast/mcast_cpp.cpp index 879d6e0550..7bc6fc19f6 100644 --- a/src/mod/endpoints/mod_verto/mcast/mcast_cpp.cpp +++ b/src/mod/endpoints/mod_verto/mcast/mcast_cpp.cpp @@ -34,7 +34,9 @@ #include "mcast.h" #include "mcast_cpp.h" #include +#ifndef WIN32 #include +#endif McastHandle::McastHandle(const char *host, int port, int flags) { diff --git a/src/mod/endpoints/mod_verto/mod_verto.2012.vcxproj b/src/mod/endpoints/mod_verto/mod_verto.2012.vcxproj index 8930918614..9061ae0544 100644 --- a/src/mod/endpoints/mod_verto/mod_verto.2012.vcxproj +++ b/src/mod/endpoints/mod_verto/mod_verto.2012.vcxproj @@ -1,4 +1,4 @@ - + @@ -20,7 +20,7 @@ mod_verto - {11C9BC3D-45E9-46E3-BE84-B8CEE4685E39} + {5B2BACE4-0F5A-4A21-930D-C0F4B1F58FA6} mod_verto Win32Proj @@ -51,18 +51,22 @@ + + + + @@ -72,6 +76,7 @@ + $(SolutionDir)\src\include;%(AdditionalIncludeDirectories);..\..\..\..\libs\openssl-$(OpenSSLVersion)\include;$(ProjectDir)..\..\..\..\libs\pthreads-w32-2-9-1;.\;.\mcast false @@ -86,6 +91,7 @@ + $(SolutionDir)\src\include;%(AdditionalIncludeDirectories);..\..\..\..\libs\openssl-$(OpenSSLVersion)\include;$(ProjectDir)..\..\..\..\libs\pthreads-w32-2-9-1;.\;.\mcast false @@ -98,6 +104,7 @@ + $(SolutionDir)\src\include;%(AdditionalIncludeDirectories);..\..\..\..\libs\openssl-$(OpenSSLVersion)\include;$(ProjectDir)..\..\..\..\libs\pthreads-w32-2-9-1;.\;.\mcast false @@ -112,6 +119,7 @@ + $(SolutionDir)\src\include;%(AdditionalIncludeDirectories);..\..\..\..\libs\openssl-$(OpenSSLVersion)\include;$(ProjectDir)..\..\..\..\libs\pthreads-w32-2-9-1;.\;.\mcast false @@ -122,14 +130,27 @@ + + + {202d7a4e-760d-4d0e-afa1-d7459ced30ff} false + + {d331904d-a00a-4694-a5a3-fcff64ab5dbe} + + + {b4b62169-5ad4-4559-8707-3d933ac5db39} + + + {df018947-0fff-4eb3-bdee-441dc81da7a4} + false + - + \ No newline at end of file diff --git a/src/mod/endpoints/mod_verto/mod_verto.c b/src/mod/endpoints/mod_verto/mod_verto.c index 3fa68853ec..0a77f9869f 100644 --- a/src/mod/endpoints/mod_verto/mod_verto.c +++ b/src/mod/endpoints/mod_verto/mod_verto.c @@ -46,10 +46,14 @@ SWITCH_MODULE_DEFINITION(mod_verto, mod_verto_load, mod_verto_shutdown, mod_vert ////////////////////////// #include +#ifndef WIN32 #include +#endif #include #include +#ifndef WIN32 #include +#endif #include #include @@ -137,15 +141,19 @@ static void verto_deinit_ssl(verto_profile_t *profile) } } -static void close_file(int *sock) +static void close_file(ws_socket_t *sock) { if (*sock > -1) { +#ifndef WIN32 close(*sock); - *sock = -1; +#else + closesocket(*sock); +#endif + *sock = ws_sock_invalid; } } -static void close_socket(int *sock) +static void close_socket(ws_socket_t *sock) { if (*sock > -1) { shutdown(*sock, 2); @@ -2161,7 +2169,7 @@ static switch_state_handler_table_t verto_state_handlers = { static void verto_set_media_options(verto_pvt_t *tech_pvt, verto_profile_t *profile) { - int i; + uint32_t i; tech_pvt->mparams->rtpip = switch_core_session_strdup(tech_pvt->session, profile->rtpip[profile->rtpip_cur++]); @@ -3622,12 +3630,16 @@ static void jrpc_init(void) -static int start_jsock(verto_profile_t *profile, int sock) +static int start_jsock(verto_profile_t *profile, ws_socket_t sock) { jsock_t *jsock = NULL; int flag = 1; int i; - unsigned int len; +#ifndef WIN32 + unsigned int len; +#else + int len; +#endif jsock_type_t ptype = PTYPE_CLIENT; switch_thread_data_t *td; switch_memory_pool_t *pool; @@ -3713,10 +3725,14 @@ static int start_jsock(verto_profile_t *profile, int sock) return -1; } -static int prepare_socket(int ip, int port) +static ws_socket_t prepare_socket(int ip, int port) { - int sock = -1; + ws_socket_t sock = ws_sock_invalid; +#ifndef WIN32 int reuse_addr = 1; +#else + char reuse_addr = 1; +#endif struct sockaddr_in addr; if ((sock = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0) { @@ -3734,12 +3750,12 @@ static int prepare_socket(int ip, int port) if (bind(sock, (struct sockaddr *) &addr, sizeof(addr)) < 0) { die("Bind Error!\n"); - return -1; + return ws_sock_invalid; } if (listen(sock, MAXPENDING) < 0) { die("Listen error\n"); - return -1; + return ws_sock_invalid; } return sock; @@ -3748,7 +3764,7 @@ static int prepare_socket(int ip, int port) close_file(&sock); - return -1; + return ws_sock_invalid; } static void handle_mcast_sub(verto_profile_t *profile) @@ -3925,7 +3941,7 @@ static void kill_profiles(void) while(--sanity > 0 && globals.profile_threads > 0) { - usleep(100000); + switch_yield(100000); } } @@ -4365,13 +4381,14 @@ static switch_status_t cmd_status(char **argv, int argc, switch_stream_handle_t int cp = 0; int cc = 0; const char *line = "================================================================================================="; + int i; stream->write_function(stream, "%25s\t%s\t %40s\t%s\n", "Name", " Type", "Data", "State"); stream->write_function(stream, "%s\n", line); switch_mutex_lock(globals.mutex); for(profile = globals.profile_head; profile; profile = profile->next) { - for (int i = 0; i < profile->i; i++) { + for (i = 0; i < profile->i; i++) { char *tmpurl = switch_mprintf("%s:%s:%d",(profile->ip[i].secure == 1) ? "wss" : "ws", profile->ip[i].local_ip, profile->ip[i].local_port); stream->write_function(stream, "%25s\t%s\t %40s\t%s\n", profile->name, "profile", tmpurl, (profile->running) ? "RUNNING" : "DOWN"); switch_safe_free(tmpurl); @@ -4408,12 +4425,13 @@ static switch_status_t cmd_xml_status(char **argv, int argc, switch_stream_handl int cp = 0; int cc = 0; const char *header = ""; + int i; stream->write_function(stream, "%s\n", header); stream->write_function(stream, "\n"); switch_mutex_lock(globals.mutex); for(profile = globals.profile_head; profile; profile = profile->next) { - for (int i = 0; i < profile->i; i++) { + for (i = 0; i < profile->i; i++) { char *tmpurl = switch_mprintf("%s:%s:%d",(profile->ip[i].secure == 1) ? "wss" : "ws", profile->ip[i].local_ip, profile->ip[i].local_port); stream->write_function(stream, "\n%s\n%s\n%s\n%s\n\n", profile->name, "profile", tmpurl, (profile->running) ? "RUNNING" : "DOWN"); switch_safe_free(tmpurl); @@ -4506,7 +4524,7 @@ static void *SWITCH_THREAD_FUNC profile_thread(switch_thread_t *thread, void *ob switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "profile %s shutdown, Waiting for %d threads\n", profile->name, profile->jsock_count); while(--sanity > 0 && profile->jsock_count > 0) { - usleep(100000); + switch_yield(100000); } verto_deinit_ssl(profile); @@ -5321,7 +5339,9 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_verto_load) memset(&globals, 0, sizeof(globals)); globals.pool = pool; +#ifndef WIN32 globals.ready = SIGUSR1; +#endif globals.enable_presence = SWITCH_TRUE; globals.enable_fs_events = SWITCH_FALSE; diff --git a/src/mod/endpoints/mod_verto/mod_verto.h b/src/mod/endpoints/mod_verto/mod_verto.h index bafc0184c8..e1953f67b7 100644 --- a/src/mod/endpoints/mod_verto/mod_verto.h +++ b/src/mod/endpoints/mod_verto/mod_verto.h @@ -36,19 +36,29 @@ #include #include #include +#ifdef WIN32 +#include +#else #include #include #include +#endif #include +#ifndef WIN32 #include #include +#endif #include +#ifndef WIN32 #include #include +#endif #include #include +#ifndef WIN32 #include #include +#endif #include #include "mcast.h" @@ -89,7 +99,7 @@ typedef enum { struct verto_profile_s; struct jsock_s { - int client_socket; + ws_socket_t client_socket; switch_memory_pool_t *pool; switch_thread_t *thread; wsh_t ws; @@ -99,10 +109,12 @@ struct jsock_s { struct sockaddr_in local_addr; struct sockaddr_in remote_addr; struct sockaddr_in send_addr; +#ifndef WIN32 struct passwd pw; +#endif int drop; - int local_sock; + ws_socket_t local_sock; SSL *ssl; jpflag_t flags; @@ -198,7 +210,7 @@ struct verto_profile_s { jsock_t *jsock_head; int jsock_count; - int server_socket[MAX_BIND]; + ws_socket_t server_socket[MAX_BIND]; int running; int ssl_ready; diff --git a/src/mod/endpoints/mod_verto/ws.c b/src/mod/endpoints/mod_verto/ws.c index 51ae0f13f7..67646175d6 100644 --- a/src/mod/endpoints/mod_verto/ws.c +++ b/src/mod/endpoints/mod_verto/ws.c @@ -656,7 +656,11 @@ ssize_t ws_close(wsh_t *wsh, int16_t reason) restore_socket(wsh->sock); if (wsh->close_sock && wsh->sock != ws_sock_invalid) { +#ifndef WIN32 close(wsh->sock); +#else + closesocket(wsh->sock); +#endif } wsh->sock = ws_sock_invalid; diff --git a/src/mod/endpoints/mod_verto/ws.h b/src/mod/endpoints/mod_verto/ws.h index 7f5f5c48b4..1dd85a5d93 100644 --- a/src/mod/endpoints/mod_verto/ws.h +++ b/src/mod/endpoints/mod_verto/ws.h @@ -11,11 +11,11 @@ #include #include #include +#include #else #pragma warning(disable:4996) #endif #include -#include #include #include #include @@ -26,7 +26,9 @@ #include #ifdef _MSC_VER +#ifndef strncasecmp #define strncasecmp _strnicmp +#endif #define snprintf _snprintf #ifdef _WIN64 #define WS_SSIZE_T __int64 @@ -48,8 +50,12 @@ struct ws_globals_s { extern struct ws_globals_s ws_globals; +#ifndef WIN32 typedef int ws_socket_t; -#define ws_sock_invalid -1 +#else +typedef SOCKET ws_socket_t; +#endif +#define ws_sock_invalid (ws_socket_t)-1 typedef enum {