ssl-server: Add CONTEXT_PORT_NO_LISTEN_SERVER
Special port setting to disable listening for a server using socket adoption. This contrasts with CONTEXT_PORT_NO_LISTEN which does the same for a client. In particular, server-side SSL is not disabled by CONTEXT_PORT_NO_LISTEN_SERVER as it is by CONTEXT_PORT_NO_LISTEN.
This commit is contained in:
parent
63627e7e86
commit
f3ad9540fa
3 changed files with 6 additions and 6 deletions
|
@ -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"
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Reference in a new issue