@@ -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 {
@@ -293,8 +291,18 @@ func (middleware *Middleware) ipcNotificationLoop(reader *ipcnotification.Reader
293
291
} else {
294
292
log .Printf ("Could not parse %s notification payload: %v\n " , notification .Topic , notification .Payload )
295
293
}
294
+ case "systemstate-changed" :
295
+ if middleware .hsmFirmware == nil {
296
+ log .Println ("Received an IPC notification that the system state changed, but there is no HSM recognized. Not sending an extra HSM heartbeat." )
297
+ break
298
+ }
299
+ log .Println ("Received an IPC notification that the system state changed. Sending an extra HSM heartbeat." )
300
+ err := middleware .hsmHeartbeat ()
301
+ if err != nil {
302
+ log .Printf ("Warning: error while sending a extra HSM heartbeat because the systemstate changed: %s\n " , err )
303
+ }
296
304
default :
297
- log .Printf ("Dropping IPC notification with unknown topic: %s\n " , notification .String ())
305
+ log .Printf ("Dropping an IPC notification with unknown topic: %s\n " , notification .String ())
298
306
}
299
307
}
300
308
}
0 commit comments