mirror of
https://codeberg.org/guix/guix.git
synced 2025-10-02 02:15:12 +00:00
services: transmission: Remove custom ‘stop’ implementation.
This ‘stop’ methods had two problems: 1. It is incompatible with the Shepherd 1.0, where the running value is a <process> record and not a PID. 2. It is unreliable because its ‘waitpid’ calls compete with those made by shepherd’s main event loop upon SIGCHLD. * gnu/services/file-sharing.scm (transmission-daemon-shepherd-service): Change ‘stop’ to use ‘make-kill-destructor’. Change-Id: I406eb619d4a72bb5afe6200ac5c8f68736a78d97
This commit is contained in:
parent
abc45761ab
commit
9f77db78e6
1 changed files with 5 additions and 26 deletions
|
@ -648,33 +648,12 @@ satisfy requests from peers."))
|
||||||
#:log-file #$%transmission-daemon-log-file
|
#:log-file #$%transmission-daemon-log-file
|
||||||
#:environment-variables
|
#:environment-variables
|
||||||
'("CURL_CA_BUNDLE=/etc/ssl/certs/ca-certificates.crt")))
|
'("CURL_CA_BUNDLE=/etc/ssl/certs/ca-certificates.crt")))
|
||||||
(stop #~(lambda (pid)
|
|
||||||
(kill pid SIGTERM)
|
|
||||||
|
|
||||||
;; Transmission Daemon normally needs some time to shut down,
|
;; Transmission Daemon normally needs some time to shut down, as it will
|
||||||
;; as it will complete some housekeeping and send a final
|
;; complete some housekeeping and send a final update to trackers before
|
||||||
;; update to trackers before it exits.
|
;; it exits.
|
||||||
;;
|
(stop #~(make-kill-destructor #:grace-period #$stop-wait-period))
|
||||||
;; Wait a reasonable period for it to stop before continuing.
|
|
||||||
;; If we don't do this, restarting the service can fail as the
|
|
||||||
;; new daemon process finds the old one still running and
|
|
||||||
;; attached to the port used for peer connections.
|
|
||||||
(let wait-before-killing ((period #$stop-wait-period))
|
|
||||||
(if (zero? (car (waitpid pid WNOHANG)))
|
|
||||||
(if (positive? period)
|
|
||||||
(begin
|
|
||||||
(sleep 1)
|
|
||||||
(wait-before-killing (- period 1)))
|
|
||||||
(begin
|
|
||||||
(format #t
|
|
||||||
#$(G_ "Wait period expired; killing \
|
|
||||||
transmission-daemon (pid ~a).~%")
|
|
||||||
pid)
|
|
||||||
(display #$(G_ "(If you see this message \
|
|
||||||
regularly, you may need to increase the value
|
|
||||||
of 'stop-wait-period' in the service configuration.)\n"))
|
|
||||||
(kill pid SIGKILL)))))
|
|
||||||
#f))
|
|
||||||
(actions
|
(actions
|
||||||
(list
|
(list
|
||||||
(shepherd-action
|
(shepherd-action
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue