aboutsummaryrefslogtreecommitdiffhomepage
path: root/cmd/mbf/daemon.go
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/mbf/daemon.go')
-rw-r--r--cmd/mbf/daemon.go24
1 files changed, 23 insertions, 1 deletions
diff --git a/cmd/mbf/daemon.go b/cmd/mbf/daemon.go
index cadbf57e..a40eb27d 100644
--- a/cmd/mbf/daemon.go
+++ b/cmd/mbf/daemon.go
@@ -70,6 +70,9 @@ const (
// specialCancel is a message consisting of a single identifier referring
// to a curing artifact to be cancelled.
specialCancel = iota
+ // specialAbort requests for all pending cures to be aborted. It has no
+ // message body.
+ specialAbort
// remoteSpecial denotes a special message with custom layout.
remoteSpecial = math.MaxUint64
@@ -189,6 +192,10 @@ func serve(
pkg.Encode(*id),
)
}
+
+ case specialAbort:
+ log.Println("aborting all pending cures")
+ cm.c.Abort()
}
return
@@ -291,7 +298,7 @@ func cureRemote(
return p, err
}
-// cureRemote cancels a [pkg.Artifact] curing on a daemon.
+// cancelRemote cancels a [pkg.Artifact] curing on a daemon.
func cancelRemote(
ctx context.Context,
addr *net.UnixAddr,
@@ -316,3 +323,18 @@ func cancelRemote(
}
return conn.Close()
}
+
+// abortRemote aborts all [pkg.Artifact] curing on a daemon.
+func abortRemote(
+ ctx context.Context,
+ addr *net.UnixAddr,
+) error {
+ done, conn, err := dial(ctx, addr)
+ if err != nil {
+ return err
+ }
+ defer close(done)
+
+ err = writeSpecialHeader(conn, specialAbort)
+ return errors.Join(err, conn.Close())
+}