Lines Matching defs:wsi

113 lws_role_call_alpn_negotiated(struct lws *wsi, const char *alpn)
120 lwsl_wsi_info(wsi, "'%s'", alpn);
127 lws_metrics_tag_wsi_add(wsi, "upg", ar->name);
130 alpn_negotiated(wsi, alpn);
138 lws_role_call_adoption_bind(struct lws *wsi, int type, const char *prot)
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;
156 lwsl_wsi_err(wsi, "can't find role '%s'",
157 wsi->a.vhost->listen_accept_role);
159 if (!strcmp(wsi->a.vhost->listen_accept_role, "raw-proxy"))
164 adoption_bind(wsi, type, prot);
172 lwsl_wsi_debug(wsi, "leaving bound to role %s",
173 wsi->role_ops->name);
177 lwsl_wsi_warn(wsi, "adoption bind to role '%s', "
179 wsi->a.vhost->listen_accept_role, prot, type);
190 adoption_bind(wsi, type, prot))
198 adoption_bind(wsi, type, prot))
203 lwsl_wsi_notice(wsi, "falling back to raw file role bind");
209 adoption_bind(wsi, type, prot))
218 lws_role_call_client_bind(struct lws *wsi,
224 client_bind(wsi, i);
237 client_bind(wsi, i))
1075 lws_cancel_service_pt(struct lws *wsi)
1077 lws_plat_pipe_signal(wsi->a.context, wsi->tsi);
1102 struct lws *wsi;
1121 wsi = __lws_wsi_create_with_role(context, n, &role_ops_pipe,
1123 if (!wsi)
1126 __lws_lc_tag(context, &context->lcg[LWSLCG_WSI], &wsi->lc,
1129 wsi->event_pipe = 1;
1130 pt->pipe_wsi = wsi;
1132 if (!lws_plat_pipe_create(wsi)) {
1142 wsi->desc.sockfd = context->pt[n].dummy_pipe_fds[0];
1143 // lwsl_debug("event pipe fd %d\n", wsi->desc.sockfd);
1145 if (lws_wsi_inject_to_loop(pt, wsi))
1158 lws_destroy_event_pipe(struct lws *wsi)
1162 lwsl_wsi_info(wsi, "in");
1164 n = lws_wsi_extract_from_loop(wsi);
1165 lws_plat_pipe_close(wsi);
1167 lws_free(wsi);
1171 * Start close process for any wsi bound to this vhost that belong to the
1173 * protocol staged close on wsi, latency with pts joining in closing their
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
1184 /* calling pt thread has done its wsi dieback */
1201 * destroy any wsi that are associated with us but have no socket
1220 * Close any wsi on this pt bound to the vhost
1225 struct lws *wsi = wsi_from_fd(ctx, pt->fds[n].fd);
1227 if (wsi && wsi->tsi == tsi && wsi->a.vhost == vh) {
1229 lwsl_wsi_debug(wsi, "pt %d: closin, role %s", tsi,
1230 wsi->role_ops->name);
1232 lws_wsi_close(wsi, LWS_TO_KILL_ASYNC);
1234 if (pt->pipe_wsi == wsi)
1241 /* calling pt thread has done its wsi dieback */
1318 * PHASE 1: take down or reassign any listen wsi
1332 struct lws *wsi = lws_container_of(d, struct lws, listen_list);
1346 * this can only be a listen wsi, which is
1356 lws_dll2_remove(&wsi->listen_list);
1357 lws_dll2_add_tail(&wsi->listen_list,
1366 * complete the transfer. Add a fake wsi
1370 __lws_vhost_unbind_wsi(wsi);
1371 lws_vhost_bind_wsi(v, wsi);
1373 * ... remove the fake wsi bind
1383 * If any listen wsi left we couldn't pass to other vhosts, close them
1388 struct lws *wsi = lws_container_of(d, struct lws, listen_list);
1390 lws_dll2_remove(&wsi->listen_list);
1391 lws_wsi_close(wsi, LWS_TO_KILL_ASYNC);
1422 * Either start close or destroy any wsi on the vhost that belong to this pt,
1433 struct lws wsi;
1458 memset(&wsi, 0, sizeof(wsi));
1459 wsi.a.context = vh->context;
1460 wsi.a.vhost = vh; /* not a real bound wsi */
1465 wsi.a.protocol = protocol;
1470 protocol->callback(&wsi, LWS_CALLBACK_PROTOCOL_DESTROY,
1566 * although async event callbacks may still come for wsi handles with
1606 * crosses SMP thread boundaries, a wsi on any pt can bind to any vhost. If we
1611 * in their wsi) can happens asynchronously, so we can't just linearly do some
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
1638 /* start async closure of all wsi on this pt thread attached to vh */
1651 * We have some wsi bound to this vhost, we have to wait for these to
1654 * When the last bound wsi on this vh is destroyed we will auto-call
1659 /* alert other pts they also need to do dieback flow for their wsi */
1701 struct lws *wsi = lws_container_of(d, struct lws,
1704 wsi->socket_is_permanently_unusable = 1;
1705 lws_close_free_wsi(wsi, LWS_CLOSE_STATUS_NOSTATUS,
1737 * This is the logic checking to see if the new connection wsi should have a
1750 lws_vhost_active_conns(struct lws *wsi, struct lws **nwsi, const char *adsin)
1753 const char *my_alpn = lws_wsi_client_stash_item(wsi, CIS_ALPN,
1759 if ((wsi->tls.use_ssl & LCCSCF_USE_SSL) &&
1768 if (!lws_dll2_is_detached(&wsi->dll2_cli_txn_queue)) {
1770 wsi->dll2_cli_txn_queue.owner, struct lws,
1778 if (wsi->mux.parent_wsi) {
1783 *nwsi = wsi->mux.parent_wsi;
1789 lws_context_lock(wsi->a.context, __func__); /* -------------- cx { */
1790 lws_vhost_lock(wsi->a.vhost); /* ----------------------------------- { */
1793 wsi->a.vhost->dll_cli_active_conns_owner.head) {
1797 lwsl_wsi_debug(wsi, "check %s %s %s %d %d",
1801 wsi->c_port, w->c_port);
1803 if (w != wsi &&
1811 (w->role_ops == wsi->role_ops ||
1812 (lwsi_role_http(w) && lwsi_role_http(wsi))) &&
1819 (wsi->tls.use_ssl & LCCSCF_USE_SSL) ==
1823 wsi->c_port == w->c_port) {
1855 wsi->client_h2_alpn = 1;
1856 lws_wsi_h2_adopt(w, wsi);
1857 lws_vhost_unlock(wsi->a.vhost); /* } ---------- */
1858 lws_context_unlock(wsi->a.context); /* -------------- cx { */
1872 if (lwsi_role_mqtt(wsi) && w->client_mux_migrated &&
1875 if (lws_wsi_mqtt_adopt(w, wsi)) {
1877 lws_dll2_remove(&wsi->dll2_cli_txn_queue);
1878 wsi->client_mux_substream = 1;
1880 lws_vhost_unlock(wsi->a.vhost); /* } ---------- */
1881 lws_context_unlock(wsi->a.context); /* -------------- cx { */
1894 lwsl_wsi_notice(wsi, "apply txn queue %s, state 0x%lx",
1901 lws_dll2_add_tail(&wsi->dll2_cli_txn_queue,
1912 lws_vhost_unlock(wsi->a.vhost); /* } ---------- */
1913 lws_context_unlock(wsi->a.context); /* -------------- cx { */
1923 lws_vhost_unlock(wsi->a.vhost); /* } ---------------------------------- */
1924 lws_context_unlock(wsi->a.context); /* -------------- cx { */