Julien Pierre wrote:
> You should use PR_Recv() for this case, not PR_Read().

Unless it is a nonblocking socket, in which case either call works.

One issue with trying to select/poll the underlying fd is setting the 
right event flags.  During the SSL handshake, an NSPR-level read 
operation could block on a write to the underlying fd and vice versa. 
After the handshake, if the last write to the underlying fd returned 
EWOULDBLOCK, then a subsequent NSPR-level read will make progress on 
either readability or writability of the underlying fd.

PR_Poll() takes care of these issues.  If you are using native 
select/poll, you will need to either call the poll method of the 
PRFileDesc to find out which events to give to select/poll or you will 
have to implement your own lowest layer PRFileDesc which keeps track of 
which underlying fd read/writes last returned EWOULDBLOCK.


Reply via email to