You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix bad_weak_ptr when close a ClientConnection during construction
Fixes#348Fixes#349
### Motivation
When `close` is called in `ClientConnection`'s constructor,
`shared_from_this()` will be called, which results in a
`std::bad_weak_ptr` error. This error does not happen before
#317 because
`shared_from_this()` could only be called when the `producers` or
`consumers` field is not empty.
### Modifications
Add a `ResultException` and throw it if there is a failure in
`ClientConnection`'s constructor and catch it in
`ConnectionPool::getConnectionAsync`. Then retrieve the result and
return the failed future.
Since `close` is now always called on a constructed `ClientConnection`
object, remove the 2nd parameter.
In addition, check `authentication_` even for non-TLS URLs. Otherwise,
the null authentication will be used to construct `CommandConnect`.
Add `testInvalidPlugin` and `testTlsConfigError` to verify the changes.
0 commit comments