Skip to content

Commit

Permalink
Report fail if binding to a socket fails in websockets (meetecho#2534)
Browse files Browse the repository at this point in the history
  • Loading branch information
Symbiatch committed Jan 26, 2021
1 parent 674367a commit 4d97028
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions transports/janus_websockets.c
Original file line number Diff line number Diff line change
Expand Up @@ -636,7 +636,9 @@ int janus_websockets_init(janus_transport_callbacks *callback, const char *confi
info.ssl_private_key_password = NULL;
info.gid = -1;
info.uid = -1;
info.options = 0;
#if (LWS_LIBRARY_VERSION_MAJOR == 3 && LWS_LIBRARY_VERSION_MINOR >= 2) || (LWS_LIBRARY_VERSION_MAJOR > 3)
info.options = LWS_SERVER_OPTION_FAIL_UPON_UNABLE_TO_BIND;
#endif
/* Create the WebSocket context */
wss = lws_create_vhost(wsc, &info);
if(wss == NULL) {
Expand Down Expand Up @@ -701,10 +703,10 @@ int janus_websockets_init(janus_transport_callbacks *callback, const char *confi
info.ssl_cipher_list = ciphers;
info.gid = -1;
info.uid = -1;
#if LWS_LIBRARY_VERSION_MAJOR >= 2
#if (LWS_LIBRARY_VERSION_MAJOR == 3 && LWS_LIBRARY_VERSION_MINOR >= 2) || (LWS_LIBRARY_VERSION_MAJOR > 3)
info.options = LWS_SERVER_OPTION_DO_SSL_GLOBAL_INIT | LWS_SERVER_OPTION_FAIL_UPON_UNABLE_TO_BIND;
#elif LWS_LIBRARY_VERSION_MAJOR >= 2
info.options = LWS_SERVER_OPTION_DO_SSL_GLOBAL_INIT;
#else
info.options = 0;
#endif
/* Create the secure WebSocket context */
swss = lws_create_vhost(wsc, &info);
Expand Down Expand Up @@ -753,7 +755,9 @@ int janus_websockets_init(janus_transport_callbacks *callback, const char *confi
info.ssl_private_key_password = NULL;
info.gid = -1;
info.uid = -1;
info.options = 0;
#if (LWS_LIBRARY_VERSION_MAJOR == 3 && LWS_LIBRARY_VERSION_MINOR >= 2) || (LWS_LIBRARY_VERSION_MAJOR > 3)
info.options = LWS_SERVER_OPTION_FAIL_UPON_UNABLE_TO_BIND;
#endif
/* Create the WebSocket context */
admin_wss = lws_create_vhost(wsc, &info);
if(admin_wss == NULL) {
Expand Down Expand Up @@ -818,10 +822,10 @@ int janus_websockets_init(janus_transport_callbacks *callback, const char *confi
info.ssl_cipher_list = ciphers;
info.gid = -1;
info.uid = -1;
#if LWS_LIBRARY_VERSION_MAJOR >= 2
#if (LWS_LIBRARY_VERSION_MAJOR == 3 && LWS_LIBRARY_VERSION_MINOR >= 2) || (LWS_LIBRARY_VERSION_MAJOR > 3)
info.options = LWS_SERVER_OPTION_DO_SSL_GLOBAL_INIT | LWS_SERVER_OPTION_FAIL_UPON_UNABLE_TO_BIND;
#elif LWS_LIBRARY_VERSION_MAJOR >= 2
info.options = LWS_SERVER_OPTION_DO_SSL_GLOBAL_INIT;
#else
info.options = 0;
#endif
/* Create the secure WebSocket context */
admin_swss = lws_create_vhost(wsc, &info);
Expand Down

0 comments on commit 4d97028

Please sign in to comment.