From df199858780cb7a0605947d6d9d08ecd90f6b30d Mon Sep 17 00:00:00 2001 From: Steve Baker Date: Mon, 2 Nov 2015 16:05:03 +1300 Subject: [PATCH] Only bind on tmpsocket once Since change I8f566543c8da28eb7ed76f1cb80ff4cb2dcbba96 openstackbmc has failed to start with the error: socket.error: [Errno 22] Invalid argument Moving the early bind so that it is only done when there is no server specified has fixed the regression for openstackbmc. Change-Id: Icb16cdc386fb08b54f28b7dff235eb697f1450ee --- pyghmi/ipmi/private/session.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pyghmi/ipmi/private/session.py b/pyghmi/ipmi/private/session.py index ee1b751d..f219bbaa 100644 --- a/pyghmi/ipmi/private/session.py +++ b/pyghmi/ipmi/private/session.py @@ -302,10 +302,10 @@ class Session(object): tmpsocket = socket.socket(socket.AF_INET6, socket.SOCK_DGRAM) # INET6 # can do IPv4 if you are nice to it tmpsocket.setsockopt(IPPROTO_IPV6, socket.IPV6_V6ONLY, 0) - # Rather than wait until send() to bind, bind now so that we have - # a port number allocated no matter what - tmpsocket.bind(('', 0)) if server is None: + # Rather than wait until send() to bind, bind now so that we have + # a port number allocated no matter what + tmpsocket.bind(('', 0)) cls.socketpool[tmpsocket] = 1 else: tmpsocket.bind(server)