Commit 23bd12cb authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Make VSL_Dispatch reopen the vsm when idle-timeout kicks in.



git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@4955 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent ad1f8bb7
......@@ -194,7 +194,7 @@ h_order(void *priv, enum vsl_tag tag, unsigned fd, unsigned len,
}
static void
do_order(const struct VSM_data *vd, int argc, char * const *argv)
do_order(struct VSM_data *vd, int argc, char * const *argv)
{
int i;
const char *error;
......
......@@ -250,7 +250,7 @@ vsl_handler VSL_H_Print;
struct VSM_data;
void VSL_Select(const struct VSM_data *vd, unsigned tag);
void VSL_NonBlocking(const struct VSM_data *vd, int nb);
int VSL_Dispatch(const struct VSM_data *vd, vsl_handler *func, void *priv);
int VSL_Dispatch(struct VSM_data *vd, vsl_handler *func, void *priv);
int VSL_NextLog(const struct VSM_data *lh, uint32_t **pp);
extern const char *VSL_tags[256];
......
......@@ -266,7 +266,7 @@ VSL_NextLog(const struct VSM_data *vd, uint32_t **pp)
/*--------------------------------------------------------------------*/
int
VSL_Dispatch(const struct VSM_data *vd, vsl_handler *func, void *priv)
VSL_Dispatch(struct VSM_data *vd, vsl_handler *func, void *priv)
{
struct vsl *vsl;
int i;
......@@ -279,6 +279,8 @@ VSL_Dispatch(const struct VSM_data *vd, vsl_handler *func, void *priv)
while (1) {
i = VSL_NextLog(vd, &p);
if (i == 0 && VSM_ReOpen(vd, 0) == 1)
continue;
if (i != 1)
return (i);
u = VSL_ID(p);
......@@ -325,21 +327,15 @@ VSL_H_Print(void *priv, enum vsl_tag tag, unsigned fd, unsigned len,
/*--------------------------------------------------------------------*/
int
VSL_Open(struct VSM_data *vd, int diag)
void
vsl_open_cb(struct VSM_data *vd)
{
struct vsl *vsl;
struct vsm_chunk *sha;
int i;
CHECK_OBJ_NOTNULL(vd, VSM_MAGIC);
vsl = vd->vsl;
CHECK_OBJ_NOTNULL(vsl, VSL_MAGIC);
i = VSM_Open(vd, diag);
if (i)
return (i);
sha = vsm_find_alloc(vd, VSL_CLASS, "", "");
assert(sha != NULL);
......@@ -349,6 +345,24 @@ VSL_Open(struct VSM_data *vd, int diag)
vsl->last_seq = vsl->log_start[0];
VRMB();
}
/*--------------------------------------------------------------------*/
int
VSL_Open(struct VSM_data *vd, int diag)
{
struct vsl *vsl;
int i;
CHECK_OBJ_NOTNULL(vd, VSM_MAGIC);
vsl = vd->vsl;
CHECK_OBJ_NOTNULL(vsl, VSL_MAGIC);
i = VSM_Open(vd, diag);
if (i)
return (i);
if (!vsl->d_opt && vsl->r_fd == -1) {
while (*vsl->log_ptr != VSL_ENDMARKER)
vsl->log_ptr = VSL_NEXT(vsl->log_ptr);
......
......@@ -191,6 +191,9 @@ vsm_open(struct VSM_data *vd, int diag)
while(slh.alloc_seq == 0)
(void)usleep(50000); /* XXX limit total sleep */
vd->alloc_seq = slh.alloc_seq;
if (vd->vsl != NULL)
vsl_open_cb(vd);
return (0);
}
......
......@@ -64,3 +64,4 @@ struct vsm_chunk *vsm_find_alloc(const struct VSM_data *vd, const char *class,
void vsc_delete(struct VSM_data *vd);
void vsl_delete(struct VSM_data *vd);
void vsl_open_cb(struct VSM_data *vd);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment