What this change means
Source files changed in ways the catalog does not model (for example logic inside Verify). Read the diff to judge the effect.
| @@ -126,19 +126,34 @@ func shouldIgnore(uri string, ignorePatterns []*regexp.Regexp) bool { | ||
| 126 | 126 | return false |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | added: const defaultSQLServerPort = 1433 | |
| 130 | added: | |
| 131 | added: // preDialAddress returns the host:port the driver will dial, or false when the | |
| 132 | added: // port is resolved through SQL Browser and can't be checked ahead of time. | |
| 133 | added: func preDialAddress(config msdsn.Config) (string, bool) { | |
| 134 | added: port := config.Port | |
| 135 | added: if port == 0 { | |
| 136 | added: if config.Instance != "" { | |
| 137 | added: return "", false | |
| 138 | added: } | |
| 139 | added: port = defaultSQLServerPort | |
| 140 | added: } | |
| 141 | added: return net.JoinHostPort(config.Host, strconv.Itoa(int(port))), true | |
| 142 | added: } | |
| 143 | added: | |
| 129 | 144 | var ping = func(ctx context.Context, config msdsn.Config) (bool, error) { |
| 130 | 145 | // TCP connectivity check to prevent indefinite hangs |
| 131 | removed: address := net.JoinHostPort(config.Host, strconv.Itoa(int(config.Port))) | |
| 132 | removed: | |
| 133 | removed: dialer := &net.Dialer{ | |
| 134 | removed: Timeout: 3 * time.Second, | |
| 135 | removed: } | |
| 146 | added: if address, ok := preDialAddress(config); ok { | |
| 147 | added: dialer := &net.Dialer{ | |
| 148 | added: Timeout: 3 * time.Second, | |
| 149 | added: } | |
| 136 | 150 | |
| 137 | removed: tcpConn, err := dialer.DialContext(ctx, "tcp", address) // respects context timeout | |
| 138 | removed: if err != nil { | |
| 139 | removed: return false, err | |
| 151 | added: tcpConn, err := dialer.DialContext(ctx, "tcp", address) // respects context timeout | |
| 152 | added: if err != nil { | |
| 153 | added: return false, err | |
| 154 | added: } | |
| 155 | added: defer func() { _ = tcpConn.Close() }() | |
| 140 | 156 | } |
| 141 | removed: defer func() { _ = tcpConn.Close() }() | |
| 142 | 157 | |
| 143 | 158 | cleanConfig := msdsn.Config{} |
| 144 | 159 | cleanConfig.Host = config.Host |