[Pkg-voip-commits] [janus] 118/163: Moved websockets ping/pong setup from the vhosts to the main context
Jonas Smedegaard
dr at jones.dk
Sat Oct 28 01:22:21 UTC 2017
This is an automated email from the git hooks/post-receive script.
js pushed a commit to annotated tag debian/0.2.5-1
in repository janus.
commit c136fc550b7b0b80d51973bfc814252fa576aeee
Author: Lorenzo Miniero <lminiero at gmail.com>
Date: Tue Sep 26 15:50:09 2017 +0200
Moved websockets ping/pong setup from the vhosts to the main context
---
transports/janus_websockets.c | 43 ++++++++++++++-----------------------------
1 file changed, 14 insertions(+), 29 deletions(-)
diff --git a/transports/janus_websockets.c b/transports/janus_websockets.c
index 21b8bf6..3f6835d 100644
--- a/transports/janus_websockets.c
+++ b/transports/janus_websockets.c
@@ -315,11 +315,6 @@ int janus_websockets_init(janus_transport_callbacks *callback, const char *confi
struct lws_context_creation_info wscinfo;
memset(&wscinfo, 0, sizeof wscinfo);
wscinfo.options |= LWS_SERVER_OPTION_EXPLICIT_VHOSTS;
- wsc = lws_create_context(&wscinfo);
- if(wsc == NULL) {
- JANUS_LOG(LOG_ERR, "Error creating libwebsockets context...\n");
- return -1; /* No point in keeping the plugin loaded */
- }
/* We use vhosts on the same context to address both APIs, secure or not */
struct lws_vhost *wss = NULL, *swss = NULL,
@@ -437,6 +432,20 @@ int janus_websockets_init(janus_transport_callbacks *callback, const char *confi
if((pingpong_trigger && !pingpong_timeout) || (!pingpong_trigger && pingpong_timeout)) {
JANUS_LOG(LOG_WARN, "pingpong_trigger and pingpong_timeout not both set, ignoring...\n");
}
+#if LWS_LIBRARY_VERSION_MAJOR >= 2 && LWS_LIBRARY_VERSION_MINOR >= 1
+ if(pingpong_trigger > 0 && pingpong_timeout > 0) {
+ wscinfo.ws_ping_pong_interval = pingpong_trigger;
+ wscinfo.timeout_secs = pingpong_timeout;
+ }
+#endif
+
+ /* Create the base context */
+ wsc = lws_create_context(&wscinfo);
+ if(wsc == NULL) {
+ JANUS_LOG(LOG_ERR, "Error creating libwebsockets context...\n");
+ janus_config_destroy(config);
+ return -1; /* No point in keeping the plugin loaded */
+ }
/* Setup the Janus API WebSockets server(s) */
item = janus_config_get_item_drilldown(config, "general", "ws");
@@ -473,12 +482,6 @@ int janus_websockets_init(janus_transport_callbacks *callback, const char *confi
info.gid = -1;
info.uid = -1;
info.options = 0;
-#if LWS_LIBRARY_VERSION_MAJOR >= 2 && LWS_LIBRARY_VERSION_MINOR >= 1
- if(pingpong_trigger > 0 && pingpong_timeout > 0) {
- info.ws_ping_pong_interval = pingpong_trigger;
- info.timeout_secs = pingpong_timeout;
- }
-#endif
/* Create the WebSocket context */
wss = lws_create_vhost(wsc, &info);
if(wss == NULL) {
@@ -536,12 +539,6 @@ int janus_websockets_init(janus_transport_callbacks *callback, const char *confi
#else
info.options = 0;
#endif
-#if LWS_LIBRARY_VERSION_MAJOR >= 2 && LWS_LIBRARY_VERSION_MINOR >= 1
- if(pingpong_trigger > 0 && pingpong_timeout > 0) {
- info.ws_ping_pong_interval = pingpong_trigger;
- info.timeout_secs = pingpong_timeout;
- }
-#endif
/* Create the secure WebSocket context */
swss = lws_create_vhost(wsc, &info);
if(swss == NULL) {
@@ -587,12 +584,6 @@ int janus_websockets_init(janus_transport_callbacks *callback, const char *confi
info.gid = -1;
info.uid = -1;
info.options = 0;
-#if LWS_LIBRARY_VERSION_MAJOR >= 2 && LWS_LIBRARY_VERSION_MINOR >= 1
- if(pingpong_trigger > 0 && pingpong_timeout > 0) {
- info.ws_ping_pong_interval = pingpong_trigger;
- info.timeout_secs = pingpong_timeout;
- }
-#endif
/* Create the WebSocket context */
admin_wss = lws_create_vhost(wsc, &info);
if(admin_wss == NULL) {
@@ -650,12 +641,6 @@ int janus_websockets_init(janus_transport_callbacks *callback, const char *confi
#else
info.options = 0;
#endif
-#if LWS_LIBRARY_VERSION_MAJOR >= 2 && LWS_LIBRARY_VERSION_MINOR >= 1
- if(pingpong_trigger > 0 && pingpong_timeout > 0) {
- info.ws_ping_pong_interval = pingpong_trigger;
- info.timeout_secs = pingpong_timeout;
- }
-#endif
/* Create the secure WebSocket context */
admin_swss = lws_create_vhost(wsc, &info);
if(admin_swss == NULL) {
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-voip/janus.git
More information about the Pkg-voip-commits
mailing list