Set fallbackPort to 0 in SetTLSPortPolicy

The default fallback port should be reset to 0 when setting the TLS port policy. This ensures the fallbackPort does not retain an incorrect value when switching policies.
This commit is contained in:
Winni Neessen 2024-10-23 14:39:28 +02:00
parent c5b57543c1
commit 3efd2b529f
Signed by: wneessen
GPG key ID: 385AC9889632126E

View file

@ -751,6 +751,7 @@ func (c *Client) SetTLSPolicy(policy TLSPolicy) {
func (c *Client) SetTLSPortPolicy(policy TLSPolicy) {
if c.port == DefaultPort {
c.port = DefaultPortTLS
c.fallbackPort = 0
if policy == TLSOpportunistic {
c.fallbackPort = DefaultPort