Lines Matching refs:conn
55 struct conn *conn;
64 struct conn *conn;
72 struct conn *conn = h->conn_if_sspc_onw;
77 if (conn && conn->ss)
78 conn->ss->wsi = NULL;
88 if (m->conn->wsi) /* if possible, request client conn write */
89 lws_callback_on_writable(m->conn->wsi);
95 struct conn *conn = (struct conn *)parconn;
98 if (!conn || !conn->wsi || !conn->ss)
101 pt = &conn->wsi->a.context->pt[(int)conn->wsi->tsi];
103 if (lws_fi(&conn->ss->fic, "ssproxy_dsh_create_oom"))
105 conn->dsh = lws_dsh_create(&pt->ss_dsh_owner, dsh_size, 2);
106 if (!conn->dsh)
109 __lws_lc_tag_append(&conn->wsi->lc, lws_ss_tag(conn->ss));
142 n = lws_ss_serialize_rx_payload(m->conn->dsh, buf, len,
156 if (!m->conn->onward_in_flow_control && m->ss->wsi &&
158 lws_dsh_get_size(m->conn->dsh, KIND_SS_TO_P) >=
162 (unsigned long)lws_dsh_get_size(m->conn->dsh, KIND_SS_TO_P),
170 m->conn->onward_in_flow_control = 1;
173 if (m->conn->wsi) /* if possible, request client conn write */
174 lws_callback_on_writable(m->conn->wsi);
191 if (!m->conn->ss || m->conn->state != LPCSPROX_OPERATIONAL) {
204 if (lws_ss_deserialize_tx_payload(m->conn->dsh, m->ss->wsi,
209 if (!lws_dsh_get_head(m->conn->dsh, KIND_C_TO_P, (void **)&p, &si))
210 _lws_ss_request_tx(m->conn->ss);
242 * conn is private to -process.c, call thru to a) adjust
258 if (__lws_ss_proxy_bind_ss_to_conn_wsi(m->conn, dsh_size)) {
269 if (!m->conn)
271 if (!m->conn->wsi) {
274 * connection has already gone away... destroy the conn.
276 lwsl_info("%s: Destroying conn\n", __func__);
277 lws_dsh_destroy(&m->conn->dsh);
278 free(m->conn);
279 m->conn = NULL;
288 if (!m->conn) {
289 lwsl_warn("%s: dropping state due to conn not up\n", __func__);
294 if (lws_ss_serialize_state(m->conn->wsi, m->conn->dsh, state, ack))
301 if (m->conn->wsi) /* if possible, request client conn write */
302 lws_callback_on_writable(m->conn->wsi);
312 if (!m->conn)
315 lws_ss_serialize_txcr(m->conn->dsh, bump);
317 if (m->conn->wsi) /* if possible, request client conn write */
318 lws_callback_on_writable(m->conn->wsi);
331 struct conn *conn = NULL;
342 conn = pss->conn;
359 pss->conn = NULL;
361 pss->conn = malloc(sizeof(struct conn));
362 if (!pss->conn)
365 memset(pss->conn, 0, sizeof(*pss->conn));
369 pss->conn->wsi = wsi;
370 wsi->bound_ss_proxy_conn = 1; /* opaque is conn */
372 pss->conn->state = LPCSPROX_WAIT_INITIAL_TX;
385 if (!conn)
389 * the client unix domain socket connection (wsi / conn->wsi)
397 assert(conn->wsi == wsi);
398 conn->wsi = NULL;
403 /* sever relationship with conn */
407 * The current wsi is decoupled from the pss / conn and
408 * the conn no longer has a pointer on it.
410 * If there's an outgoing, proxied SS conn on our behalf, we
414 if (conn->ss) {
415 struct lws *cw = conn->ss->wsi;
417 * conn->ss is the onward connection SS
421 __func__, lws_ss_tag(conn->ss),
422 lws_wsi_tag(conn->ss->wsi));
424 /* sever conn relationship with ss about to be deleted */
426 conn->ss->wsi = NULL;
436 * longer relate to the conn... otherwise when
443 lws_ss_destroy(&conn->ss);
451 if (conn->state == LPCSPROX_DESTROYED || !conn->ss) {
454 * connection is closing. Destroy the conn.
456 lws_dsh_destroy(&conn->dsh);
457 free(conn);
458 pss->conn = NULL;
460 lwsl_debug("%s: CLOSE; %s\n", __func__, lws_ss_tag(conn->ss));
470 if (!conn || !conn->wsi) {
471 lwsl_err("%s: rx with bad conn state\n", __func__);
478 if (conn->state == LPCSPROX_WAIT_INITIAL_TX) {
483 offsetof(ss_proxy_t, conn);
491 n = lws_ss_deserialize_parse(&conn->parser,
492 lws_get_context(wsi), conn->dsh, in, len,
493 &conn->state, conn, &conn->ss, &ssi, 0);
500 if (conn->ss)
501 lws_ss_destroy(&conn->ss);
505 if (conn->state == LPCSPROX_REPORTING_FAIL ||
506 conn->state == LPCSPROX_REPORTING_OK)
507 lws_callback_on_writable(conn->wsi);
521 if (!conn || !conn->wsi)
529 switch (conn->state) {
540 lws_ser_wu32be((uint8_t *)&s[4], conn->ss &&
541 conn->ss->policy ?
542 conn->ss->policy->client_buflen : 0);
549 if (conn->ss) {
550 rsp = conn->ss->policy;
562 conn->state = LPCSPROX_OPERATIONAL;
573 md = conn->ss->metadata;
613 if (conn->ss->conmon_json) {
614 unsigned int xlen = conn->ss->conmon_len;
622 memcpy(&p[3], conn->ss->conmon_json, xlen);
624 lws_free_set_NULL(conn->ss->conmon_json);
636 if (lws_dsh_get_head(conn->dsh, KIND_SS_TO_P,
691 switch (conn->state) {
695 if (!conn)
705 if (conn->onward_in_flow_control &&
706 conn->ss->policy->proxy_buflen_rxflow_on_above &&
707 conn->ss->wsi &&
708 lws_dsh_get_size(conn->dsh, KIND_SS_TO_P) <
709 conn->ss->policy->proxy_buflen_rxflow_off_below) {
711 lws_wsi_tag(conn->ss->wsi),
712 (unsigned long)lws_dsh_get_size(conn->dsh, KIND_SS_TO_P),
713 (unsigned long)conn->ss->policy->proxy_buflen,
714 (unsigned long)conn->ss->policy->proxy_buflen_rxflow_off_below);
719 lws_rx_flow_control(conn->ss->wsi,
721 conn->onward_in_flow_control = 0;
724 if (!lws_dsh_get_head(conn->dsh, KIND_SS_TO_P,