mirror of
https://github.com/warmcat/libwebsockets.git
synced 2025-03-30 00:00:16 +01:00
async_dns: protocols init: make sure we add vhost once
This commit is contained in:
parent
a04aaad7f0
commit
06229deb8c
1 changed files with 14 additions and 3 deletions
|
@ -818,10 +818,21 @@ lws_create_vhost(struct lws_context *context,
|
||||||
*/
|
*/
|
||||||
#if defined(LWS_WITH_SYS_ASYNC_DNS)
|
#if defined(LWS_WITH_SYS_ASYNC_DNS)
|
||||||
if (!context->vhost_list) {
|
if (!context->vhost_list) {
|
||||||
|
uint8_t seen = 0;
|
||||||
|
|
||||||
|
for (n = 0; n < m; n++)
|
||||||
|
if (!memcmp(&lwsp[n], &lws_async_dns_protocol, sizeof(struct lws_protocols))) {
|
||||||
|
/* Already defined */
|
||||||
|
seen = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!seen) {
|
||||||
memcpy(&lwsp[m++], &lws_async_dns_protocol,
|
memcpy(&lwsp[m++], &lws_async_dns_protocol,
|
||||||
sizeof(struct lws_protocols));
|
sizeof(struct lws_protocols));
|
||||||
vh->count_protocols++;
|
vh->count_protocols++;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(LWS_WITH_SECURE_STREAMS)
|
#if defined(LWS_WITH_SECURE_STREAMS)
|
||||||
|
|
Loading…
Add table
Reference in a new issue