-
Type: Bug
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: None
-
None
The connection.connect function wraps the supplied context using context.WithCancel and stores the returned cancellation function so we can abort connection establishment. We need to ensure we call that function in a defer after connect finishes and also set it to nil because the cancellation function holds a reference to the context, which pins all of the memory that the context has stored.
This will require a mutex for syncrhonization because the cancellation function is accessed by both the connect and closeConnectContext functions.