本文整理汇总了C++中VSLb函数的典型用法代码示例。如果您正苦于以下问题:C++ VSLb函数的具体用法?C++ VSLb怎么用?C++ VSLb使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了VSLb函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: vbe_dir_finish
vbe_dir_finish(const struct director *d, struct worker *wrk,
struct busyobj *bo)
{
struct backend *bp;
struct vbc *vbc;
CHECK_OBJ_NOTNULL(d, DIRECTOR_MAGIC);
CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC);
CAST_OBJ_NOTNULL(bp, d->priv, BACKEND_MAGIC);
CHECK_OBJ_NOTNULL(bo->htc, HTTP_CONN_MAGIC);
CAST_OBJ_NOTNULL(vbc, bo->htc->priv, VBC_MAGIC);
bo->htc->priv = NULL;
if (vbc->state != VBC_STATE_USED)
VBT_Wait(wrk, vbc);
if (bo->htc->doclose != SC_NULL) {
VSLb(bo->vsl, SLT_BackendClose, "%d %s", vbc->fd,
bp->display_name);
VBT_Close(bp->tcp_pool, &vbc);
Lck_Lock(&bp->mtx);
} else {
VSLb(bo->vsl, SLT_BackendReuse, "%d %s", vbc->fd,
bp->display_name);
Lck_Lock(&bp->mtx);
VSC_C_main->backend_recycle++;
VBT_Recycle(wrk, bp->tcp_pool, &vbc);
}
assert(bp->n_conn > 0);
bp->n_conn--;
#define ACCT(foo) bp->vsc->foo += bo->acct.foo;
#include "tbl/acct_fields_bereq.h"
#undef ACCT
Lck_Unlock(&bp->mtx);
bo->htc = NULL;
}
示例2: HSH_AddString
void
HSH_AddString(struct req *req, const char *str)
{
int l;
CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
if (str == NULL)
str = "";
l = strlen(str);
AN(req->sha256ctx);
SHA256_Update(req->sha256ctx, str, l);
SHA256_Update(req->sha256ctx, "#", 1);
VSLb(req->vsl, SLT_Hash, "%s", str);
}
示例3: vrt_do_string
static void
vrt_do_string(const struct http *hp, int fld,
const char *err, const char *p, va_list ap)
{
const char *b;
CHECK_OBJ_NOTNULL(hp, HTTP_MAGIC);
b = VRT_String(hp->ws, NULL, p, ap);
if (b == NULL || *b == '\0') {
VSLb(hp->vsl, SLT_LostHeader, "%s", err);
WS_MarkOverflow(hp->ws);
return;
}
http_SetH(hp, fld, b);
}
示例4: bes_conn_try
static void
bes_conn_try(struct busyobj *bo, struct vbc *vc, const struct vdi_simple *vs)
{
int s;
struct backend *bp = vs->backend;
char abuf1[VTCP_ADDRBUFSIZE];
char pbuf1[VTCP_PORTBUFSIZE];
CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC);
CHECK_OBJ_NOTNULL(vs, VDI_SIMPLE_MAGIC);
Lck_Lock(&bp->mtx);
bp->refcount++;
bp->n_conn++; /* It mostly works */
Lck_Unlock(&bp->mtx);
s = -1;
assert(bp->ipv6 != NULL || bp->ipv4 != NULL);
/* release lock during stuff that can take a long time */
if (cache_param->prefer_ipv6 && bp->ipv6 != NULL) {
s = vbe_TryConnect(bo, PF_INET6, bp->ipv6, vs);
vc->addr = bp->ipv6;
}
if (s == -1 && bp->ipv4 != NULL) {
s = vbe_TryConnect(bo, PF_INET, bp->ipv4, vs);
vc->addr = bp->ipv4;
}
if (s == -1 && !cache_param->prefer_ipv6 && bp->ipv6 != NULL) {
s = vbe_TryConnect(bo, PF_INET6, bp->ipv6, vs);
vc->addr = bp->ipv6;
}
vc->fd = s;
if (s < 0) {
Lck_Lock(&bp->mtx);
bp->n_conn--;
bp->refcount--; /* Only keep ref on success */
Lck_Unlock(&bp->mtx);
vc->addr = NULL;
} else {
VTCP_myname(s, abuf1, sizeof abuf1, pbuf1, sizeof pbuf1);
VSLb(bo->vsl, SLT_BackendOpen, "%d %s %s %s ",
vc->fd, vs->backend->display_name, abuf1, pbuf1);
}
}
示例5: VRT_count
void
VRT_count(VRT_CTX, unsigned u)
{
CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
CHECK_OBJ_NOTNULL(ctx->vcl, VCL_MAGIC);
CHECK_OBJ_NOTNULL(ctx->vcl->conf, VCL_CONF_MAGIC);
assert(u < ctx->vcl->conf->nref);
if (ctx->vsl != NULL)
VSLb(ctx->vsl, SLT_VCL_trace, "%s %u %u.%u.%u",
ctx->vcl->loaded_name, u, ctx->vcl->conf->ref[u].source,
ctx->vcl->conf->ref[u].line, ctx->vcl->conf->ref[u].pos);
else
VSL(SLT_VCL_trace, 0, "%s %u %u.%u.%u",
ctx->vcl->loaded_name, u, ctx->vcl->conf->ref[u].source,
ctx->vcl->conf->ref[u].line, ctx->vcl->conf->ref[u].pos);
}
示例6: http_PutField
static void
http_PutField(const struct http *to, int field, const char *string)
{
char *p;
CHECK_OBJ_NOTNULL(to, HTTP_MAGIC);
p = WS_Copy(to->ws, string, -1);
if (p == NULL) {
http_fail(to);
VSLb(to->vsl, SLT_LostHeader, "%s", string);
return;
}
to->hd[field].b = p;
to->hd[field].e = strchr(p, '\0');
to->hdf[field] = 0;
http_VSLH(to, field);
}
示例7: VRT_re_match
int
VRT_re_match(struct req *req, const char *s, void *re)
{
vre_t *t;
int i;
CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
if (s == NULL)
s = "";
AN(re);
t = re;
i = VRE_exec(t, s, strlen(s), 0, 0, NULL, 0, &cache_param->vre_limits);
if (i >= 0)
return (1);
if (i < VRE_ERROR_NOMATCH )
VSLb(req->vsl, SLT_VCL_Error, "Regexp matching returned %d", i);
return (0);
}
示例8: VRT_l_client_identity
void
VRT_l_client_identity(const struct vrt_ctx *ctx, const char *str, ...)
{
va_list ap;
const char *b;
CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
CHECK_OBJ_NOTNULL(ctx->req, REQ_MAGIC);
va_start(ap, str);
b = VRT_String(ctx->req->http->ws, NULL, str, ap);
va_end(ap);
if (b == NULL) {
VSLb(ctx->vsl, SLT_LostHeader, "client.identity");
WS_MarkOverflow(ctx->req->http->ws);
return;
}
ctx->req->client_identity = b;
}
示例9: VRT_l_beresp_storage_hint
void
VRT_l_beresp_storage_hint(const struct vrt_ctx *ctx, const char *str, ...)
{
va_list ap;
const char *b;
CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
CHECK_OBJ_NOTNULL(ctx->bo, BUSYOBJ_MAGIC);
va_start(ap, str);
b = VRT_String(ctx->bo->ws, NULL, str, ap); // XXX: ctx->ws ?
va_end(ap);
if (b == NULL) {
VSLb(ctx->vsl, SLT_LostHeader, "storage.hint");
WS_MarkOverflow(ctx->bo->beresp->ws);
return;
}
ctx->bo->storage_hint = b;
}
示例10: STV_NewObject
int
STV_NewObject(struct worker *wrk, struct objcore *oc,
const struct stevedore *stv, unsigned wsl)
{
CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC);
CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
CHECK_OBJ_NOTNULL(stv, STEVEDORE_MAGIC);
assert(wsl > 0);
wrk->strangelove = cache_param->nuke_limit;
AN(stv->allocobj);
if (stv->allocobj(wrk, stv, oc, wsl) == 0)
return (0);
wrk->stats->n_object++;
VSLb(wrk->vsl, SLT_Storage, "%s %s",
oc->stobj->stevedore->name, oc->stobj->stevedore->ident);
return (1);
}
示例11: vfp_esi_init
vfp_esi_init(struct vfp_ctx *vc, struct vfp_entry *vfe)
{
struct vef_priv *vef;
CHECK_OBJ_NOTNULL(vc, VFP_CTX_MAGIC);
CHECK_OBJ_NOTNULL(vc->req, HTTP_MAGIC);
if (http_GetStatus(vc->resp) == 206) {
VSLb(vc->wrk->vsl, SLT_VCL_Error,
"Attempted ESI on partial (206) response");
return (VFP_ERROR);
}
ALLOC_OBJ(vef, VEF_MAGIC);
if (vef == NULL)
return (VFP_ERROR);
vc->obj_flags |= OF_ESIPROC;
vef->vep = VEP_Init(vc, vc->req, NULL, NULL);
vfe->priv1 = vef;
return (VFP_OK);
}
示例12: vmod_append
vmod_append(VRT_CTX, VCL_HEADER hdr, const char *fmt, ...)
{
va_list ap;
struct http *hp;
const char *b;
CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
assert(fmt != NULL);
hp = VRT_selecthttp(ctx, hdr->where);
va_start(ap, fmt);
b = VRT_String(hp->ws, hdr->what + 1, fmt, ap);
if (b == NULL)
VSLb(ctx->vsl, SLT_LostHeader, "vmod_header: %s",
hdr->what + 1);
else
http_SetHeader(hp, b);
va_end(ap);
}
示例13: vmod_ip
VCL_IP
vmod_ip(VRT_CTX, VCL_STRING s, VCL_IP d)
{
struct addrinfo hints, *res0 = NULL;
const struct addrinfo *res;
int error;
void *p;
struct suckaddr *r;
CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
AN(d);
assert(VSA_Sane(d));
p = WS_Alloc(ctx->ws, vsa_suckaddr_len);
if (p == NULL) {
VSLb(ctx->vsl, SLT_VCL_Error,
"vmod std.ip(): insufficient workspace");
return d;
}
r = NULL;
if (s != NULL) {
memset(&hints, 0, sizeof(hints));
hints.ai_family = PF_UNSPEC;
hints.ai_socktype = SOCK_STREAM;
error = getaddrinfo(s, "80", &hints, &res0);
if (!error) {
for (res = res0; res != NULL; res = res->ai_next) {
r = VSA_Build(p, res->ai_addr, res->ai_addrlen);
if (r != NULL)
break;
}
}
}
if (r == NULL) {
r = p;
memcpy(r, d, vsa_suckaddr_len);
}
if (res0 != NULL)
freeaddrinfo(res0);
return (r);
}
示例14: vbe_dir_http1pipe
static enum sess_close
vbe_dir_http1pipe(const struct director *d, struct req *req, struct busyobj *bo)
{
int i;
enum sess_close retval;
struct backend *bp;
struct v1p_acct v1a;
struct vbc *vbc;
CHECK_OBJ_NOTNULL(d, DIRECTOR_MAGIC);
CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC);
CAST_OBJ_NOTNULL(bp, d->priv, BACKEND_MAGIC);
memset(&v1a, 0, sizeof v1a);
/* This is hackish... */
v1a.req = req->acct.req_hdrbytes;
req->acct.req_hdrbytes = 0;
req->res_mode = RES_PIPE;
vbc = vbe_dir_getfd(req->wrk, bp, bo);
if (vbc == NULL) {
VSLb(bo->vsl, SLT_FetchError, "no backend connection");
retval = SC_TX_ERROR;
} else {
i = V1F_SendReq(req->wrk, bo, &v1a.bereq, 1);
VSLb_ts_req(req, "Pipe", W_TIM_real(req->wrk));
if (vbc->state == VBC_STATE_STOLEN)
VBT_Wait(req->wrk, vbc);
if (i == 0)
V1P_Process(req, vbc->fd, &v1a);
VSLb_ts_req(req, "PipeSess", W_TIM_real(req->wrk));
bo->htc->doclose = SC_TX_PIPE;
vbe_dir_finish(d, req->wrk, bo);
retval = SC_TX_PIPE;
}
V1P_Charge(req, &v1a, bp->vsc);
return (retval);
}
示例15: htc_request_check_host_hdr
static uint16_t
htc_request_check_host_hdr(const struct http *hp)
{
int u;
int seen_host = 0;
for (u = HTTP_HDR_FIRST; u < hp->nhd; u++) {
if (hp->hd[u].b == NULL)
continue;
AN(hp->hd[u].b);
AN(hp->hd[u].e);
if (http_IsHdr(&hp->hd[u], H_Host)) {
if (seen_host) {
VSLb(hp->vsl, SLT_Error,
"Duplicated Host header");
return (400);
}
seen_host = 1;
}
}
return (0);
}