Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix peer connect panic. Fixes #2173 #2174

Merged
merged 1 commit into from
Jul 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions controller/model/controller_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,12 +231,14 @@ func (self *ControllerManager) PeersConnected(peers []*event.ClusterPeer) {
selfAsPeer := self.getCurrentAsClusterPeer()
peerFingerprints := ""
for _, peer := range peers {
fingerprint := nfpem.FingerprintFromCertificate(peer.ServerCert[0])
if len(peer.ServerCert) > 0 {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe a nit, but why not just test for nil instead of finding the len ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

covers both cases: nil and empty

fingerprint := nfpem.FingerprintFromCertificate(peer.ServerCert[0])

if peerFingerprints == "" {
peerFingerprints = fingerprint
} else {
peerFingerprints = peerFingerprints + ", " + fingerprint
if peerFingerprints == "" {
peerFingerprints = fingerprint
} else {
peerFingerprints = peerFingerprints + ", " + fingerprint
}
}
}

Expand Down
Loading