tm.tm_hour, tm.tm_min, tm.tm_sec, (int)(date.tv_usec/1000),
error_snapshot_id);
- if (ci_putchk(si_ic(si), &trash) == -1) {
- /* Socket buffer full. Let's try again later from the same point */
- si_applet_cant_put(si);
- return 0;
- }
+ if (ci_putchk(si_ic(si), &trash) == -1)
+ goto cant_send;
appctx->ctx.errors.px = proxies_list;
appctx->ctx.errors.bol = 0;
while (appctx->ctx.errors.px) {
struct error_snapshot *es;
+ HA_SPIN_LOCK(PROXY_LOCK, &appctx->ctx.errors.px->lock);
+
if ((appctx->ctx.errors.flag & 1) == 0) {
es = &appctx->ctx.errors.px->invalid_req;
if (appctx->ctx.errors.flag & 2) // skip req
chunk_appendf(&trash, " \n");
- if (ci_putchk(si_ic(si), &trash) == -1) {
- /* Socket buffer full. Let's try again later from the same point */
- si_applet_cant_put(si);
- return 0;
- }
+ if (ci_putchk(si_ic(si), &trash) == -1)
+ goto cant_send_unlock;
+
appctx->ctx.errors.ptr = 0;
appctx->ctx.errors.ev_id = es->ev_id;
}
/* the snapshot changed while we were dumping it */
chunk_appendf(&trash,
" WARNING! update detected on this snapshot, dump interrupted. Please re-check!\n");
- if (ci_putchk(si_ic(si), &trash) == -1) {
- si_applet_cant_put(si);
- return 0;
- }
+ if (ci_putchk(si_ic(si), &trash) == -1)
+ goto cant_send_unlock;
+
goto next;
}
newline = appctx->ctx.errors.bol;
newptr = dump_text_line(&trash, es->buf, global.tune.bufsize, es->buf_len, &newline, appctx->ctx.errors.ptr);
if (newptr == appctx->ctx.errors.ptr)
- return 0;
+ goto cant_send_unlock;
+
+ if (ci_putchk(si_ic(si), &trash) == -1)
+ goto cant_send_unlock;
- if (ci_putchk(si_ic(si), &trash) == -1) {
- /* Socket buffer full. Let's try again later from the same point */
- si_applet_cant_put(si);
- return 0;
- }
appctx->ctx.errors.ptr = newptr;
appctx->ctx.errors.bol = newline;
};
next:
+ HA_SPIN_UNLOCK(PROXY_LOCK, &appctx->ctx.errors.px->lock);
appctx->ctx.errors.bol = 0;
appctx->ctx.errors.ptr = -1;
appctx->ctx.errors.flag ^= 1;
/* dump complete */
return 1;
+
+ cant_send_unlock:
+ HA_SPIN_UNLOCK(PROXY_LOCK, &appctx->ctx.errors.px->lock);
+ cant_send:
+ si_applet_cant_put(si);
+ return 0;
}
/* register cli keywords */