···
# Don't do the rest of this for socket-activated units
# because we handled these above where we stop the unit.
# Since only services can be socket-activated, the
# following condition always evaluates to `true` for
198
-
if (!$socketActivated) {
199
-
# If we are restarting a socket, also stop the corresponding
200
-
# service. This is required because restarting a socket
201
-
# when the service is already activated fails.
202
-
if ($unit =~ /\.socket$/) {
203
-
my $service = $unitInfo->{Service} // "";
204
-
if ($service eq "") {
205
-
$service = "$baseName.service";
207
-
if (defined $activePrev->{$service}) {
208
-
$unitsToStop->{$service} = 1;
199
+
if ($socketActivated) {
203
+
# If we are restarting a socket, also stop the corresponding
204
+
# service. This is required because restarting a socket
205
+
# when the service is already activated fails.
206
+
if ($unit =~ /\.socket$/) {
207
+
my $service = $unitInfo->{Service} // "";
208
+
if ($service eq "") {
209
+
$service = "$baseName.service";
211
+
if (defined $activePrev->{$service}) {
212
+
$unitsToStop->{$service} = 1;
214
+
$unitsToRestart->{$unit} = 1;
215
+
recordUnit($restartListFile, $unit);
217
+
# Always restart non-services instead of stopping and starting them
218
+
# because it doesn't make sense to stop them with a config from
219
+
# the old evaluation.
220
+
if (!boolIsTrue($unitInfo->{'X-StopIfChanged'} // "yes") || $unit !~ /\.service$/) {
221
+
# This unit should be restarted instead of
222
+
# stopped and started.
$unitsToRestart->{$unit} = 1;
recordUnit($restartListFile, $unit);
213
-
# Always restart non-services instead of stopping and starting them
214
-
# because it doesn't make sense to stop them with a config from
215
-
# the old evaluation.
216
-
if (!boolIsTrue($unitInfo->{'X-StopIfChanged'} // "yes") || $unit !~ /\.service$/) {
217
-
# This unit should be restarted instead of
218
-
# stopped and started.
219
-
$unitsToRestart->{$unit} = 1;
220
-
recordUnit($restartListFile, $unit);
222
-
# We write to a file to ensure that the
223
-
# service gets restarted if we're interrupted.
224
-
$unitsToStart->{$unit} = 1;
225
-
recordUnit($startListFile, $unit);
226
-
$unitsToStop->{$unit} = 1;
226
+
# We write to a file to ensure that the
227
+
# service gets restarted if we're interrupted.
228
+
$unitsToStart->{$unit} = 1;
229
+
recordUnit($startListFile, $unit);
230
+
$unitsToStop->{$unit} = 1;