From abe4c7c92a6a0c569d7b8b95ec2112964e9ceac3 Mon Sep 17 00:00:00 2001 From: Fabian Wiesel Date: Mon, 25 May 2015 17:37:16 +0200 Subject: [PATCH] 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. --- python/nghttp2.pyx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/python/nghttp2.pyx b/python/nghttp2.pyx index c6b9b66c..9b2b0bfd 100644 --- a/python/nghttp2.pyx +++ b/python/nghttp2.pyx @@ -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()