Skip to content

Commit 9fa40f7

Browse files
committed
csppsolver: Ignore shutdown signals
1 parent f711f7d commit 9fa40f7

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

cmd/csppsolver/solver.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import (
44
"math/big"
55
"net/rpc"
66
"os"
7+
"os/signal"
8+
"syscall"
79

810
"decred.org/cspp/v2/solver"
911
)
@@ -72,6 +74,13 @@ func (*Solver) Roots(args Args, res *Result) error {
7274
}
7375

7476
func main() {
77+
// Ignore SIGINT and other clean shutdown signals (and Windows
78+
// equivalents). When csppsolver is in the same process group as
79+
// dcrwallet, it must continue running for any ongoing mixes even
80+
// after shutdown is signaled. It will eventually exit later after
81+
// the stdin pipe is closed.
82+
signal.Ignore(os.Interrupt, syscall.SIGTERM, syscall.SIGHUP)
83+
7584
s := rpc.NewServer()
7685
err := s.Register(new(Solver))
7786
if err != nil {

0 commit comments

Comments
 (0)