5
0
mirror of https://github.com/cwinfo/yggdrasil-go.git synced 2024-12-22 17:35:39 +00:00

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 <neilalexander@users.noreply.github.com>
This commit is contained in:
Neil 2023-11-04 18:42:42 +00:00 committed by GitHub
parent 93a5adfd18
commit 0346af46da
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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