Пример #1
0
static void stream_http_response_cb(liStream *stream, liStreamEvent event) {
	liStreamHttpResponse* shr = LI_CONTAINER_OF(stream, liStreamHttpResponse, stream);

	switch (event) {
	case LI_STREAM_NEW_DATA:
		stream_http_response_data(shr);
		break;
	case LI_STREAM_DISCONNECTED_DEST:
		shr->vr = NULL;
		li_stream_disconnect(stream);
		break;
	case LI_STREAM_DISCONNECTED_SOURCE:
		shr->vr = NULL;
		if (!stream->out->is_closed) {
			/* "abort" */
			li_stream_disconnect_dest(stream);
		}
		break;
	case LI_STREAM_DESTROY:
		li_http_response_parser_clear(&shr->parse_response_ctx);
		g_slice_free(liStreamHttpResponse, shr);
		break;
	default:
		break;
	}
}
Пример #2
0
static void proxy_connection_free(proxy_connection *pcon) {
	liVRequest *vr;
	if (!pcon) return;

	vr = pcon->vr;
	ev_io_stop(vr->wrk->loop, &pcon->fd_watcher);
	proxy_context_release(pcon->ctx);
	if (pcon->fd != -1) close(pcon->fd);
	li_vrequest_backend_finished(vr);

	li_chunkqueue_free(pcon->proxy_in);
	li_chunkqueue_free(pcon->proxy_out);
	li_buffer_release(pcon->proxy_in_buffer);

	li_http_response_parser_clear(&pcon->parse_response_ctx);

	g_slice_free(proxy_connection, pcon);
}
Пример #3
0
static void fastcgi_connection_free(fastcgi_connection *fcon) {
	liVRequest *vr;
	if (!fcon) return;

	vr = fcon->vr;
	ev_io_stop(vr->wrk->loop, &fcon->fd_watcher);
	fastcgi_context_release(fcon->ctx);
	if (fcon->fd != -1) close(fcon->fd);
	li_vrequest_backend_finished(vr);

	li_chunkqueue_free(fcon->fcgi_in);
	li_chunkqueue_free(fcon->fcgi_out);
	li_chunkqueue_free(fcon->stdout);
	li_buffer_release(fcon->fcgi_in_buffer);
	g_byte_array_free(fcon->buf_in_record, TRUE);

	li_http_response_parser_clear(&fcon->parse_response_ctx);

	g_slice_free(fastcgi_connection, fcon);
}