]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[2888] Close socket even on connect error
authorMichal 'vorner' Vaner <michal.vaner@nic.cz>
Wed, 3 Apr 2013 10:04:44 +0000 (12:04 +0200)
committerMichal 'vorner' Vaner <michal.vaner@nic.cz>
Wed, 3 Apr 2013 10:04:44 +0000 (12:04 +0200)
Even if we fail to connect, close the socket. It is loosely related to
the previous commit, as that one used unsuccessful connection attempts
to discover msgq is not ready yet and the unit tests complained. It
should have no real effect, since the garbage collector would reclaim
the socket after a while anyway.

src/lib/python/isc/cc/session.py

index fced424c642c9a8e957fa1ca4a46998a59f6f97e..636dd08f2bcfbed545c2bc7a2d19e4849bfe722e 100644 (file)
@@ -67,7 +67,9 @@ class Session:
             logger.debug(logger.DBGLVL_TRACE_BASIC, PYCC_LNAME_RECEIVED,
                          self._lname)
         except socket.error as se:
-                raise SessionError(se)
+            if self._socket:
+                self._socket.close()
+            raise SessionError(se)
 
     @property
     def lname(self):