eclipse-paho / paho.mqtt.golang

Other
2.77k stars 534 forks source link

ClientOptions Dialer introduces backward compatibility issue, when used without NewClientOptions() #576

Closed GilGil1 closed 2 years ago

GilGil1 commented 2 years ago

Hi, I'm not sure about that issue, yet it caused a working code to panic. The issue is also ours, as we are setting the ClientOptions without using the NewClientOptions(). Members are public, therefore we are tempted to set those directly. We didn't initiate the new member dialer, as it was not needed on last release v 1.3.5 The program crashes when trying to dial in file netconn.go: The change of signature, enables the use of a nil dialer: was
conn, err := tls.DialWithDialer(&net.Dialer{Timeout: timeout}, "tcp", uri.Host, tlsc) changed to: conn, err := tls.DialWithDialer(dialer, "tcp", uri.Host, tlsc)

suggest to add a protection at a line before to catch a nil dialer and replace it by the default one I can assist with a PR if needed..

MattBrittan commented 2 years ago

Thanks @GilGil1 - as this was a quick fix I have merger PR #577 to resolve the issue.