Lines Matching defs:wsi
106 * outermost create notification for wsi
131 * Notice that in SMP case, the wsi may be being created on an
151 lws_fi_inherit_copy(&new_wsi->fic, &context->fic, "wsi", fi_wsi_name);
202 * he's an allocated wsi, but he's not on any fds list or child list,
203 * join him to the vhost's list of these kinds of incomplete wsi until
233 * If the incoming wsi is bound to a vhost that is a ss server, this creates
234 * an accepted ss bound to the wsi.
287 * now bind the wsi... the problem is, this is the nwsi if it's
291 h->wsi = new_wsi;
294 /* indicate wsi should invalidate any ss link to it on close */
385 * set properties of the newly created wsi. There's no protocol
400 * Caution: after this point the wsi is live on its service thread
401 * which may be concurrent to this. We mark the wsi as still undergoing
511 lwsl_info("Peer reached wsi limit %d\n",
571 adopt_socket_readbuf(struct lws *wsi, const char *readbuf, size_t len)
577 if (!wsi)
581 return wsi;
583 if (wsi->position_in_fds_table == LWS_NO_FDS_POS)
584 return wsi;
586 pt = &wsi->a.context->pt[(int)wsi->tsi];
588 n = lws_buflist_append_segment(&wsi->buflist, (const uint8_t *)readbuf,
593 lws_dll2_add_head(&wsi->dll_buflist, &pt->dll_buflist_owner);
599 * wsi with ah that have pending rxbuf get auto-POLLIN service.
602 * readbuf data to wsi or ah yet, and we will do it next if we get
605 if (wsi->http.ah || !lws_header_table_attach(wsi, 0)) {
615 pfd = &pt->fds[wsi->position_in_fds_table];
618 if (lws_service_fd_tsi(wsi->a.context, pfd, wsi->tsi))
622 return wsi;
626 return wsi;
629 lws_close_free_wsi(wsi, LWS_CLOSE_STATUS_NOSTATUS,
644 lws_create_adopt_udp2(struct lws *wsi, const char *ads,
650 assert(wsi);
662 m = lws_sort_dns(wsi, r);
671 while (lws_dll2_get_head(&wsi->dns_sorted_list)) {
673 lws_dll2_get_head(&wsi->dns_sorted_list),
684 * if any, and then complete the adoption by binding wsi to
697 sock.sockfd = socket(wsi->pf_packet ? PF_PACKET :
699 SOCK_DGRAM, wsi->pf_packet ?
708 s->dest.sa4.sin_port = htons(wsi->c_port);
711 s->dest.sa6.sin6_port = htons(wsi->c_port);
718 if (wsi->do_broadcast &&
729 if (wsi->do_bind &&
741 if (!wsi->do_bind && !wsi->pf_packet) {
749 ads ? ads : "null", wsi->c_port,
757 if (wsi->udp)
758 wsi->udp->sa46 = s->dest;
759 wsi->sa46_peer = s->dest;
764 if (wsi->a.context->async_dns.wsi == wsi)
765 wsi->a.context->async_dns.dns_server_connected = 1;
769 lws_addrinfo_clean(wsi);
770 return lws_adopt_descriptor_vhost2(wsi,
778 lws_addrinfo_clean(wsi);
781 if (wsi->a.context->async_dns.wsi == wsi)
782 lws_async_dns_drop_server(wsi->a.context);
799 struct lws *wsi;
804 /* create the logical wsi without any valid fd */
808 wsi = __lws_adopt_descriptor_vhost1(vhost, LWS_ADOPT_SOCKET |
814 if (!wsi) {
815 lwsl_err("%s: udp wsi creation failed\n", __func__);
819 // lwsl_notice("%s: role %s\n", __func__, wsi->role_ops->name);
821 wsi->do_bind = !!(flags & LWS_CAUDP_BIND);
822 wsi->do_broadcast = !!(flags & LWS_CAUDP_BROADCAST);
823 wsi->pf_packet = !!(flags & LWS_CAUDP_PF_PACKET);
824 wsi->c_port = (uint16_t)(unsigned int)port;
826 wsi->retry_policy = retry_policy;
828 wsi->retry_policy = vhost->retry_policy;
869 wsi = lws_create_adopt_udp2(wsi, ads, r, 0, NULL);
871 return wsi;
876 * with async dns, use the wsi as the point about which to do
883 * Notice wsi has no socket at this point (we don't know what
889 lws_create_adopt_udp2, wsi,
894 wsi = NULL;
903 wsi = lws_create_adopt_udp2(wsi, ads, NULL, 0, (void *)ifname);
908 // lwsl_notice("%s: returning wsi %p\n", __func__, wsi);
910 return wsi;
914 lws_close_free_wsi(wsi, LWS_CLOSE_STATUS_NOSTATUS, "adopt udp2 fail");
915 wsi = NULL;
918 return wsi;