ionelmc / python-cogen

Automatically exported from https://code.google.com/p/cogen
MIT License
6 stars 0 forks source link

WSGIConnection fails on AF_UNIX #23

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago

WSGIConnection tries to set TCP flags despite socket family. So, when using 
AF_UNIX it raising "error: [Errno 95] Operation not supported"

http://code.google.com/p/cogen/source/browse/trunk/cogen/web/wsgi.py#160

I've solved this using simple try-except:

        try:
            self.conn.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
        except socket.error as e:
            raise
            if e.errno == 95:
                pass
            else:
                raise

Original issue reported on code.google.com by vfm...@gmail.com on 25 Oct 2010 at 8:02

GoogleCodeExporter commented 9 years ago

Original comment by ionel...@gmail.com on 25 Oct 2010 at 8:04

GoogleCodeExporter commented 9 years ago

Oops, sorry. I've copied code with waste debug string. Should be like this:

       try:
            self.conn.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
        except socket.error as e:
            if e.errno == 95:
                pass
            else:
                raise

Original comment by vfm...@gmail.com on 25 Oct 2010 at 9:34