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,9 +818,20 @@ lws_create_vhost(struct lws_context *context,
|
|||
*/
|
||||
#if defined(LWS_WITH_SYS_ASYNC_DNS)
|
||||
if (!context->vhost_list) {
|
||||
memcpy(&lwsp[m++], &lws_async_dns_protocol,
|
||||
sizeof(struct lws_protocols));
|
||||
vh->count_protocols++;
|
||||
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,
|
||||
sizeof(struct lws_protocols));
|
||||
vh->count_protocols++;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue