[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Help-gnutls] Re: [Python] Set a timeout on the connection?
From: |
Simon Josefsson |
Subject: |
[Help-gnutls] Re: [Python] Set a timeout on the connection? |
Date: |
Mon, 09 Mar 2009 22:13:31 +0100 |
User-agent: |
Gnus/5.110011 (No Gnus v0.11) Emacs/23.0.90 (gnu/linux) |
Stephane Bortzmeyer <address@hidden> writes:
> I use python-gnutls <http://pypi.python.org/pypi/python-gnutls> and it
> does not seem to have a dedicated mailing list, so I try here.
>
> The atatched code test1.py runs fine but a small modification, adding
> a timeout to the socket (test-timeout.py) crashes with:
>
> Traceback (most recent call last):
> File "test-timeout.py", line 20, in <module>
> session.handshake()
> File "/var/lib/python-support/python2.5/gnutls/connection.py", line 370, in
> handshake
> gnutls_handshake(self._c_object)
> File "/var/lib/python-support/python2.5/gnutls/library/errors.py", line 44,
> in _check_status
> raise OperationWouldBlock(gnutls_strerror(retcode))
> gnutls.errors.OperationWouldBlock: Function was interrupted.
I suspect this means one of two things:
1) The timeout was reached.
2) The socket is in non-blocking mode, and then you need to call the
gnutls_handshake function repeatedly until it either returns
successfully, or fails, or the timeout is reached. I dont know whether
the python-gnutls wrapper is expected to do this or whether your python
application code is expected to do it.
/Simon