Fix for missing disconnect when using gmp version autodetection#659
Fix for missing disconnect when using gmp version autodetection#659BaaaZen wants to merge 2 commits intogreenbone:mainfrom BaaaZen:fix-missing-disconnect
Conversation
|
We think that this could be solved in a more beautiful way by just defining an |
|
IMHO that won't work. When opening a context like this: the The |
When using the context manager on the Gmp class which determines the supported GMP version ensure that the opened connection is closed when leaving the context. Fixes #659
When using the context manager on the Gmp class which determines the supported GMP version ensure that the opened connection is closed when leaving the context. Fixes #659
When using the context manager on the Gmp class which determines the supported GMP version ensure that the opened connection is closed when leaving the context. Fixes #659
|
PR #660 addresses the problem without changing the API. |
What:
We found out that only half of the SSH connections made were closed after leaving the
Gmpcontext. After debugging the code we found out, that there is a problem when using the GMP version autodetection in combination with the use of the context manager.Why:
This patch is a proposal to fix the problem with missing connection closes when using the GMP version autodetection.
The problem is caused by returning a new object (instead of self) from the context manager. Thus the connection is opened by the "new" object (the instance of the detected GMP protocol version) and closed by the detector object (
Gmpclass). So the connection was never closed, because theGmpinstance never opened it, and the "new" object never got a disconnect.Maybe this is correlated with our support ticket
GS-854?How:
Instead of using the
Gmpclass directly for a context there is a new propertysupported_gmpthat should be used. This circumvents the problem.Checklist:
TBD