Yahel Zamir wrote:
> Hi,
> 
> I have encountered a problem in using SSL sockets in blocking mode. My
> application is multi threaded, with one thread waiting to read and
> another that is waiting to write. Upon some external input, a third
> thread tries to shutdown the connection and then close the socket.
> However, calling PR_Shutdown or PR_Close never returns from
> SSL_LOCK_READER(ss).

Calling PR_Close then is a programming error.  While one thread
is blocking in PR_Recv, another thread cannot call PR_Close on
that socket because PR_Close will free the PRFileDesc structure
representing that socket.  That is, one thread should not free
the memory still in use by another thread.  I believe the
SSL_LOCK_READER(ss) macros are intended to detect or prevent
such programming errors from crashing NSS.

Off the top of my head, I don't know why we can't call
PR_Shutdown while another thread is blocking in PR_Recv.
The presence of the SSL_LOCK_READER(ss) macro in
ssl_Shutdown (http://lxr.mozilla.org/mozilla1.8/ident?i=ssl_Shutdown)
shows it is also considered a programming error.  I just
don't know why.

Wan-Teh
_______________________________________________
dev-tech-crypto mailing list
dev-tech-crypto@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-tech-crypto

Reply via email to