Catch and log failure to set TCP_NODELAY

Setting TCP_NODELAY may fail. Instead of failing the routine, log it and continue.
It seems, that setting TCP_NODELAY in python on Mac OS X is not necessarily supported.
This commit is contained in:
Fabian Wiesel 2015-05-25 17:37:16 +02:00
parent 326b4c467b
commit abe4c7c92a
1 changed files with 4 additions and 1 deletions

View File

@ -1238,7 +1238,10 @@ if asyncio:
self.transport = transport self.transport = transport
sock = self.transport.get_extra_info('socket') sock = self.transport.get_extra_info('socket')
try:
sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1) sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
except OSError as e:
logging.info('failed to set tcp-nodelay: %s', str(e))
ssl_ctx = self.transport.get_extra_info('sslcontext') ssl_ctx = self.transport.get_extra_info('sslcontext')
if ssl_ctx: if ssl_ctx:
protocol = sock.selected_npn_protocol() protocol = sock.selected_npn_protocol()