[GODRIVER-1556] Defensively set c.nc only if the error is nil Created: 06/Apr/20  Updated: 28/Oct/23  Resolved: 20/Apr/20

Status: Closed
Project: Go Driver
Component/s: Connections
Affects Version/s: None
Fix Version/s: 1.3.3

Type: Improvement Priority: Major - P3
Reporter: Divjot Arora (Inactive) Assignee: Divjot Arora (Inactive)
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

When connections are initialized, we should check the error and only set c.nc if error is nil. This is because we check if c.nc is nil to see if the connection has been opened, so we want to make sure we don't consider the connection opened if there was an error when dialing.



 Comments   
Comment by Githook User [ 20/Apr/20 ]

Author:

{'name': 'Divjot Arora', 'email': 'divjot.arora@10gen.com', 'username': 'divjotarora'}

Message: GODRIVER-1556 Ensure underlying net.Conn is not set in error cases (#372)
Branch: release/1.3
https://github.com/mongodb/mongo-go-driver/commit/a426bf4a5c87f346b5dfaa56a33013c6cb493cb1

Comment by Githook User [ 20/Apr/20 ]

Author:

{'name': 'Divjot Arora', 'email': 'divjot.arora@10gen.com', 'username': 'divjotarora'}

Message: GODRIVER-1556 Ensure underlying net.Conn is not set in error cases (#372)
Branch: master
https://github.com/mongodb/mongo-go-driver/commit/ec937f364f9cdd2472d9e7306042f282abeaf5c5

Comment by Divjot Arora (Inactive) [ 16/Apr/20 ]

https://github.com/mongodb/mongo-go-driver/pull/372

Generated at Thu Feb 08 08:36:39 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.