Lines Matching refs:vhost
143 * if the vhost is told to bind accepted sockets to a given role,
146 if (lws_check_opt(wsi->a.vhost->options,
148 wsi->a.vhost->listen_accept_role) {
150 lws_role_by_name(wsi->a.vhost->listen_accept_role);
153 prot = wsi->a.vhost->listen_accept_protocol;
157 wsi->a.vhost->listen_accept_role);
159 if (!strcmp(wsi->a.vhost->listen_accept_role, "raw-proxy"))
179 wsi->a.vhost->listen_accept_role, prot, type);
245 lws_protocol_vh_priv_zalloc(struct lws_vhost *vhost,
250 if (!vhost || !prot || !vhost->protocols || !prot->name)
254 if (!vhost->protocol_vh_privs) {
255 vhost->protocol_vh_privs = (void **)lws_zalloc(
256 (size_t)vhost->count_protocols * sizeof(void *),
259 if (!vhost->protocol_vh_privs)
263 while (n < vhost->count_protocols && &vhost->protocols[n] != prot)
266 if (n == vhost->count_protocols) {
268 while (n < vhost->count_protocols) {
269 if (vhost->protocols[n].name &&
270 !strcmp(vhost->protocols[n].name, prot->name))
275 if (n == vhost->count_protocols) {
276 lwsl_vhost_err(vhost, "unknown protocol %p", prot);
281 vhost->protocol_vh_privs[n] = lws_zalloc((size_t)size, "vh priv");
282 return vhost->protocol_vh_privs[n];
286 lws_protocol_vh_priv_get(struct lws_vhost *vhost,
291 if (!vhost || !vhost->protocols ||
292 !vhost->protocol_vh_privs || !prot || !prot->name)
295 while (n < vhost->count_protocols && &vhost->protocols[n] != prot)
298 if (n == vhost->count_protocols) {
300 while (n < vhost->count_protocols) {
301 if (vhost->protocols[n].name &&
302 !strcmp(vhost->protocols[n].name, prot->name))
307 if (n == vhost->count_protocols) {
308 lwsl_vhost_err(vhost, "unknown protocol %p", prot);
313 return vhost->protocol_vh_privs[n];
350 * return a pointer to this vhost-protocol
397 lwsa->vhost = vh;
399 /* initialize supported protocols on this vhost */
457 * instantiate them per-vhost with pvos.
459 * Without plugins, not setting the vhost pvo
494 * inform every vhost that hasn't already done it, that
512 /* only do the protocol init once for a given vhost */
518 lwsl_vhost_warn(vh, "init vhost %s failed", vh->name);
647 * This moves all the lws_fi_t from info->fi to the vhost fi,
767 * give the vhost a unified list of protocols including:
769 * - internal, async_dns if enabled (first vhost only)
811 * 3: async dns protocol (first vhost only)
830 * 3: For compatibility, all protocols enabled on vhost if only
831 * the default vhost exists. Otherwise only vhosts who ask
1035 /* for the case we are adding a vhost much later, after server init */
1064 struct lws_vhost *vhost)
1071 return lws_context_init_client_ssl(&i, vhost);
1107 * not bound to a vhost or protocol (both are NULL)
1171 * Start close process for any wsi bound to this vhost that belong to the
1174 * wsi on the vhost, this may take some time.
1176 * When the wsi count bound to the vhost (from all pts) drops to zero, the
1177 * vhost destruction will be finalized.
1220 * Close any wsi on this pt bound to the vhost
1227 if (wsi && wsi->tsi == tsi && wsi->a.vhost == vh) {
1257 /* helper to interate every listen socket on any vhost and call cb on it */
1280 * Mark the vhost as being destroyed, so things trying to use it abort.
1293 lws_context_lock(context, "vhost destroy 1"); /* ---------- context { */
1326 * Either way the listen socket response to the vhost close is
1335 * For each of our listen sockets, check every other vhost to
1336 * see if another vhost should be given our listen socket.
1349 * swap it to a vhost that has the same
1362 * If the vhost sees it's being destroyed and
1365 * vhost opportunistically before we can
1422 * Either start close or destroy any wsi on the vhost that belong to this pt,
1455 * let the protocols destroy the per-vhost protocol objects
1460 wsi.a.vhost = vh; /* not a real bound wsi */
1478 * remove vhost from context list of vhosts
1508 * Free all the allocations associated with the vhost
1568 * they do not refer to the vhost. So it's safe to free.
1603 * Starts the vhost destroy process
1606 * crosses SMP thread boundaries, a wsi on any pt can bind to any vhost. If we
1614 * The vhost destroy is cut into two pieces:
1616 * 1) dispose of the listen socket, either by passing it on to another vhost
1619 * If any wsi bound to the vhost, mark the vhost as in the process of being
1620 * destroyed, triggering each pt to close all wsi bound to the vhost next
1624 * 2) When the number of wsis bound to the vhost reaches zero, do the final
1625 * vhost destroy flow, this can be triggered from any pt.
1651 * We have some wsi bound to this vhost, we have to wait for these to
1652 * complete close and unbind before progressing the vhost removal.
1669 lws_vhost_user(struct lws_vhost *vhost)
1671 return vhost->user;
1675 lws_get_vhost_listen_port(struct lws_vhost *vhost)
1677 return vhost->listen_port;
1694 * So, for each vhost, close his listen sockets
1742 * vhost (to ensure the same client tls ctx is involved) it's cleaner in vhost.c
1790 lws_vhost_lock(wsi->a.vhost); /* ----------------------------------- { */
1793 wsi->a.vhost->dll_cli_active_conns_owner.head) {
1857 lws_vhost_unlock(wsi->a.vhost); /* } ---------- */
1880 lws_vhost_unlock(wsi->a.vhost); /* } ---------- */
1912 lws_vhost_unlock(wsi->a.vhost); /* } ---------- */
1923 lws_vhost_unlock(wsi->a.vhost); /* } ---------------------------------- */