M2Crypto: select() behaves weird on SSL socket

Irmen de Jong irmen at NOSPAMREMOVETHISxs4all.nl
Mon Jun 10 15:29:51 EDT 2002


To add some more info...

> A.M. Kuchling wrote:
> 
>> Perhaps there really is no more data on the socket because OpenSSL has
>> read it all, but the decrypted data is now sitting in a buffer

The manual page of select(2) says:
"select  waits  for  a number of file descriptors to change status.
  Three independent sets of descriptors are watched.   Those
  listed  in  readfds  will  be watched to see if characters
  become available for reading (more precisely, to see if  a
  read  will not block - in particular, a file descriptor is
  also ready on end-of-file),  those  in  writefds  will  be
  watched  to  see  if  a write will not block, and those in
  exceptfds will be watched for exceptions."

The way I interpret this is that -buffering or not- select must
return a FD if there is more data available. In my case, the SSL
socket indeed has more data available, and a recv() on the socket
will not block. I therefore think that either M2Crypto or OpenSSL
is doing the wrong thing because select() doesn't behave as it should?
The recv() may read from a buffer, I don't care, but it doesn't
block on my next call and thus I expect select() to return the socket
as being ready for reading... am I wrong here?


irmen




More information about the Python-list mailing list