mirror of
https://opendev.org/x/pyghmi
synced 2025-08-22 19:10:19 +00:00
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
This commit is contained in:
@@ -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)
|
||||
|
Reference in New Issue
Block a user