Make VSM_Attach interruptible

Fixes #2657.
parent a50d90d5
......@@ -59,6 +59,7 @@
#include "vdef.h"
#include "vapi/vsig.h"
#include "vapi/vsm.h"
#include "vas.h"
#include "vcli.h"
......@@ -472,6 +473,9 @@ main(int argc, char * const *argv)
argc -= optind;
argv += optind;
VSIG_Arm_int();
VSIG_Arm_term();
if (T_arg != NULL) {
if (n_arg != NULL)
usage(1);
......
......@@ -154,3 +154,8 @@ process p1 -expect-text 1 0 {/1?foo=bar HTTP/1.1" 200 100 "-" "-"}
process p1 -expect-text 1 0 { - user [}
process p1 -expect-text 2 0 {/1?foo=bar HTTP/1.1" 404 248 "-" "-"}
process p1 -expect-text 3 0 {/2 HTTP/1.1" - - "-" "-"}
process p2 {varnishncsa -t 5 -n nonexistent} -start
delay 1
process p2 -expect-exit 1 -kill INT -wait
shell {grep -q "VSM: Attach interrupted" ${p2_err}}
......@@ -55,6 +55,7 @@
#include "vqueue.h"
#include "vtim.h"
#include "vapi/vsig.h"
#include "vapi/vsm.h"
#ifndef MAP_HASSEMAPHORE
......@@ -676,7 +677,7 @@ VSM_Attach(struct vsm *vd, int progress)
}
AZ(vd->attached);
while (1) {
while (!VSIG_int && !VSIG_term) {
u = VSM_Status(vd);
VSM_ResetError(vd);
if (u & VSM_MGT_RUNNING) {
......@@ -695,6 +696,7 @@ VSM_Attach(struct vsm *vd, int progress)
(void)write(progress, ".", 1);
VTIM_sleep(.25);
}
return (vsm_diag(vd, "Attach interrupted"));
}
/*--------------------------------------------------------------------*/
......
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