Skip to content

Commit fbdd66c

Browse files
authored
Merge pull request Place1#126 from DasSkelett/fix/metadata-nil-handshake
2 parents e7c2151 + cb90ac1 commit fbdd66c

File tree

2 files changed

+1
-4
lines changed

2 files changed

+1
-4
lines changed

internal/devices/devices.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -280,8 +280,5 @@ func deviceListContains(devices []*storage.Device, publicKey string) bool {
280280
}
281281

282282
func IsConnected(lastHandshake time.Time) bool {
283-
// if lastHandshake == nil {
284-
// return false
285-
// }
286283
return lastHandshake.After(time.Now().Add(-3 * time.Minute))
287284
}

internal/devices/metadata.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ func syncMetrics(d *DeviceManager) {
3030
// they may actually be connected to another replica.
3131
if peer.Endpoint != nil {
3232
if device, err := d.GetByPublicKey(peer.PublicKey.String()); err == nil {
33-
if !IsConnected(peer.LastHandshakeTime) && !IsConnected(*device.LastHandshakeTime) {
33+
if !IsConnected(peer.LastHandshakeTime) && device.LastHandshakeTime != nil && !IsConnected(*device.LastHandshakeTime) {
3434
// Not connected, and we haven't been the last time either, nothing to update
3535
continue
3636
}

0 commit comments

Comments
 (0)