2
0
mirror of https://opendev.org/x/pyghmi synced 2025-01-14 03:37:47 +00:00

Do not error if the platform does not support restricting the MAXSEG

Some depressing platforms don't support this. The intent is to work
around incorrect MTU settings for a network, which is hopefully rare,
so being opportunistic without being fatalistic seems a wise course.

Change-Id: I2108f335bdf623f6fc0a1723a8b5988c253a76b3
This commit is contained in:
Jarrod Johnson 2017-11-30 09:55:34 -05:00
parent 32cfa8fe5d
commit ced920016f

View File

@ -94,7 +94,10 @@ class SecureHTTPConnection(httplib.HTTPConnection, object):
# in this space
plainsock = socket.socket(addrinfo[0])
plainsock.settimeout(60)
plainsock.setsockopt(socket.IPPROTO_TCP, socket.TCP_MAXSEG, 1456)
try:
plainsock.setsockopt(socket.IPPROTO_TCP, socket.TCP_MAXSEG, 1456)
except socket.error:
pass
plainsock.connect(addrinfo[4])
self.sock = ssl.wrap_socket(plainsock, cert_reqs=self.cert_reqs)
# txtcert = self.sock.getpeercert() # currently not possible