Lines Matching refs:vhd

78 	struct per_vhost_data__minimal *vhd =
83 for (n = 0; n < (int)LWS_ARRAY_SIZE(vhd->pthread_spam); n++)
84 if (pthread_equal(pthread_self(), vhd->pthread_spam[n]))
89 if (!vhd->established)
92 pthread_mutex_lock(&vhd->lock_ring); /* --------- ring lock { */
95 n = (int)lws_ring_get_count_free_elements(vhd->ring);
109 n = (int)lws_ring_insert(vhd->ring, &amsg, 1);
118 lws_cancel_service(vhd->context);
121 pthread_mutex_unlock(&vhd->lock_ring); /* } ring lock ------- */
126 } while (!vhd->finished);
138 struct per_vhost_data__minimal *vhd =
141 vhd->i.context = vhd->context;
142 vhd->i.port = 7681;
143 vhd->i.address = "localhost";
144 vhd->i.path = "/publisher";
145 vhd->i.host = vhd->i.address;
146 vhd->i.origin = vhd->i.address;
147 vhd->i.ssl_connection = 0;
149 vhd->i.protocol = "lws-minimal-broker";
150 vhd->i.pwsi = &vhd->client_wsi;
152 if (!lws_client_connect_via_info(&vhd->i))
153 lws_sul_schedule(vhd->context, 0, &vhd->sul,
161 struct per_vhost_data__minimal *vhd =
174 vhd = lws_protocol_vh_priv_zalloc(lws_get_vhost(wsi),
177 vhd->context = lws_get_context(wsi);
178 vhd->protocol = lws_get_protocol(wsi);
179 vhd->vhost = lws_get_vhost(wsi);
181 vhd->ring = lws_ring_create(sizeof(struct msg), 8,
183 if (!vhd->ring)
186 pthread_mutex_init(&vhd->lock_ring, NULL);
190 for (n = 0; n < (int)LWS_ARRAY_SIZE(vhd->pthread_spam); n++)
191 if (pthread_create(&vhd->pthread_spam[n], NULL,
192 thread_spam, vhd)) {
198 sul_connect_attempt(&vhd->sul);
203 vhd->finished = 1;
204 for (n = 0; n < (int)LWS_ARRAY_SIZE(vhd->pthread_spam); n++)
205 pthread_join(vhd->pthread_spam[n], &retval);
207 if (vhd->ring)
208 lws_ring_destroy(vhd->ring);
210 lws_sul_cancel(&vhd->sul);
211 pthread_mutex_destroy(&vhd->lock_ring);
218 vhd->client_wsi = NULL;
219 lws_sul_schedule(vhd->context, 0, &vhd->sul,
227 vhd->established = 1;
231 pthread_mutex_lock(&vhd->lock_ring); /* --------- ring lock { */
232 pmsg = lws_ring_get_element(vhd->ring, &vhd->tail);
240 pthread_mutex_unlock(&vhd->lock_ring); /* } ring lock */
245 lws_ring_consume_single_tail(vhd->ring, &vhd->tail, 1);
248 if (lws_ring_get_element(vhd->ring, &vhd->tail))
253 pthread_mutex_unlock(&vhd->lock_ring); /* } ring lock ------- */
257 vhd->client_wsi = NULL;
258 vhd->established = 0;
259 lws_sul_schedule(vhd->context, 0, &vhd->sul,
272 if (vhd && vhd->client_wsi && vhd->established)
273 lws_callback_on_writable(vhd->client_wsi);