Skip to content

Commit

Permalink
Catch and log failure to set TCP_NODELAY
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
fwiesel committed May 25, 2015
1 parent 326b4c4 commit abe4c7c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion python/nghttp2.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -1238,7 +1238,10 @@ if asyncio:

self.transport = transport
sock = self.transport.get_extra_info('socket')
sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
try:
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')
if ssl_ctx:
protocol = sock.selected_npn_protocol()
Expand Down

0 comments on commit abe4c7c

Please sign in to comment.