Skip to content

Conversation

@cheenamalhotra
Copy link
Member

@cheenamalhotra cheenamalhotra commented Apr 13, 2021

Following discussion from #1016..
This change fixes possible out of bounds errors and timeout cancellation issues.
Further improvements to be reviewed in #1029.

@Wraith2
Copy link
Contributor

Wraith2 commented Apr 14, 2021

Is GetHostAddresses required to return a non-null value even if it can't resolve? If not you need to add a null check and probably early exit.

Also, while you're there... any chance of hoisting that AddressFamily array out as a static readonly so we can avoid allocating and discarding it every single time we make a connection?

@cheenamalhotra
Copy link
Member Author

cheenamalhotra commented Apr 14, 2021

@Wraith2 regarding AddressFamily suggestion, there's another PR bringing in preferred family support: https://github.com/dotnet/SqlClient/pull/1015/files#diff-11cfbefb2cd1b54e3dfda7a8eeb5d1b447086f5dbb41204151929886c29ae99fR345 so it won't be a static.

I'll see improvement opportunity to reduce allocation with that PR.

@Wraith2
Copy link
Contributor

Wraith2 commented Apr 14, 2021

Ok, LGTM then.

@cheenamalhotra cheenamalhotra merged commit 2e773ae into dotnet:main Apr 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants