From 0346af46dae233e7d95d2a08e2b992382e1f2d64 Mon Sep 17 00:00:00 2001 From: Neil Date: Sat, 4 Nov 2023 18:42:42 +0000 Subject: [PATCH] Don't panic when connect returns `nil` (fixes #1086) (#1089) * Don't panic when connect returns `nil` (fixes #1086) It isn't clear to me why this would happen but let's guard the condition anyway. * Log inconsistent error state --------- Co-authored-by: Neil Alexander --- src/core/link.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/core/link.go b/src/core/link.go index 0b2efc57..af4a5a59 100644 --- a/src/core/link.go +++ b/src/core/link.go @@ -273,7 +273,10 @@ func (l *links) add(u *url.URL, sintf string, linkType linkType) error { } conn, err := l.connect(state.ctx, u, info, options) - if err != nil { + if err != nil || conn == nil { + if err == nil && conn == nil { + l.core.log.Warnf("Link %q reached inconsistent error state", u.String()) + } if linkType == linkTypePersistent { // If the link is a persistent configured peering, // store information about the connection error so