Permalink
Browse files

Put VCL in charge of director/backend destruction for registered dire…

…ctors.
  • Loading branch information...
bsdphk committed Nov 14, 2017
1 parent 1d26aa4 commit ccd13da4d8cee3aed453346876ff205a961d266f
@@ -379,5 +379,6 @@ VBE_fill_director(struct backend *be)
d->getip = vbe_dir_getip;
d->finish = vbe_dir_finish;
d->event = vbe_dir_event;
d->destroy = VBE_Delete;
d->panic = vbe_panic;
}
@@ -458,7 +458,6 @@ VBE_Poll(void)
continue;
Lck_Unlock(&backends_mtx);
VCL_DelBackend(be->director);
VBE_Delete(be->director);
Lck_Lock(&backends_mtx);
}
Lck_Unlock(&backends_mtx);
@@ -55,6 +55,8 @@ typedef enum sess_close vdi_http1pipe_f(const struct director *, struct req *,
typedef void vdi_event_f(const struct director *, enum vcl_event_e);
typedef void vdi_destroy_f(const struct director *);
typedef void vdi_panic_f(const struct director *, struct vsb *);
struct director {
@@ -70,6 +72,7 @@ struct director {
vdi_getip_f *getip;
vdi_finish_f *finish;
vdi_event_f *event;
vdi_destroy_f *destroy;
vdi_panic_f *panic;
void *priv;
const void *priv2;
@@ -332,6 +332,7 @@ VCL_AddBackend(struct vcl *vcl, struct director *d)
CHECK_OBJ_NOTNULL(vcl, VCL_MAGIC);
CHECK_OBJ_NOTNULL(d, DIRECTOR_MAGIC);
AN(d->destroy);
AZ(errno=pthread_rwlock_rdlock(&vcl->temp_rwl));
if (vcl->temp == VCL_TEMP_COOLING) {
@@ -370,6 +371,8 @@ VCL_DelBackend(const struct director *d)
if (VCL_WARM(vcl))
VDI_Event(d, VCL_EVENT_COLD);
AZ(errno=pthread_rwlock_unlock(&vcl->temp_rwl));
AN(d->destroy);
d->destroy(d);
}
static void
@@ -398,7 +401,8 @@ vcl_KillBackends(struct vcl *vcl)
if (d == NULL)
break;
VTAILQ_REMOVE(&vcl->director_list, d, list);
VBE_Delete(d);
AN(d->destroy);
d->destroy(d);
}
}

0 comments on commit ccd13da

Please sign in to comment.