diff --git a/lib/libwebsockets.h b/lib/libwebsockets.h index d7f7df6f..be874330 100644 --- a/lib/libwebsockets.h +++ b/lib/libwebsockets.h @@ -253,6 +253,7 @@ typedef ssl_context SSL; #define CONTEXT_PORT_NO_LISTEN -1 +#define CONTEXT_PORT_NO_LISTEN_SERVER -2 /** \defgroup log Logging * @@ -1560,10 +1561,10 @@ enum lws_context_options { */ struct lws_context_creation_info { int port; - /**< VHOST: Port to listen on... you can use CONTEXT_PORT_NO_LISTEN to - * suppress listening on any port, that's what you want if you are - * not running a websocket server at all but just using it as a - * client */ + /**< VHOST: Port to listen on. Use CONTEXT_PORT_NO_LISTEN to suppress + * listening for a client. Use CONTEXT_PORT_NO_LISTEN_SERVER if you are + * writing a server but you are using \ref sock-adopt instead of the + * built-in listener */ const char *iface; /**< VHOST: NULL to bind the listen socket to all interfaces, or the * interface name, eg, "eth2" diff --git a/lib/server.c b/lib/server.c index bc9033a7..cfb08312 100644 --- a/lib/server.c +++ b/lib/server.c @@ -44,7 +44,7 @@ lws_context_init_server(struct lws_context_creation_info *info, /* set up our external listening socket we serve on */ - if (info->port == CONTEXT_PORT_NO_LISTEN) + if (info->port == CONTEXT_PORT_NO_LISTEN || info->port == CONTEXT_PORT_NO_LISTEN_SERVER) return 0; vh = vhost->context->vhost_list; diff --git a/lib/ssl-server.c b/lib/ssl-server.c index b1e21741..d458a002 100644 --- a/lib/ssl-server.c +++ b/lib/ssl-server.c @@ -211,7 +211,6 @@ lws_context_init_server_ssl(struct lws_context_creation_info *info, vhost->use_ssl = 0; return 0; } - if (info->port != CONTEXT_PORT_NO_LISTEN) { vhost->use_ssl = info->ssl_cert_filepath != NULL;