@@ -264,13 +264,11 @@ func (middleware *Middleware) ipcNotificationLoop(reader *ipcnotification.Reader
264
264
265
265
for {
266
266
notification := <- notifications
267
-
268
267
if notification .Version != supportedNotificationVersion {
269
- log .Printf ("Dropping IPC notification with unsupported version: %s\n " , notification .String ())
268
+ log .Printf ("Dropping an IPC notification with unsupported version: %s\n " , notification .String ())
270
269
}
271
270
272
- log .Printf ("Received notification with topic '%s': %v\n " , notification .Topic , notification .Payload )
273
-
271
+ log .Printf ("Received an IPC notification with topic '%s': %v\n " , notification .Topic , notification .Payload )
274
272
switch notification .Topic {
275
273
case "mender-update" :
276
274
if success , ok := ipcnotification .ParseMenderUpdatePayload (notification .Payload ); ok {
@@ -289,8 +287,18 @@ func (middleware *Middleware) ipcNotificationLoop(reader *ipcnotification.Reader
289
287
} else {
290
288
log .Printf ("Could not parse %s notification payload: %v\n " , notification .Topic , notification .Payload )
291
289
}
290
+ case "systemstate-changed" :
291
+ if middleware .hsmFirmware == nil {
292
+ log .Println ("Received an IPC notification that the system state changed, but there is no HSM recognized. Not sending an extra HSM heartbeat." )
293
+ break
294
+ }
295
+ log .Println ("Received an IPC notification that the system state changed. Sending an extra HSM heartbeat." )
296
+ err := middleware .hsmHeartbeat ()
297
+ if err != nil {
298
+ log .Printf ("Warning: error while sending a extra HSM heartbeat because the systemstate changed: %s\n " , err )
299
+ }
292
300
default :
293
- log .Printf ("Dropping IPC notification with unknown topic: %s\n " , notification .String ())
301
+ log .Printf ("Dropping an IPC notification with unknown topic: %s\n " , notification .String ())
294
302
}
295
303
}
296
304
}
0 commit comments