From db6ff863faafe8fab03a0cf09efd6239ea1a0f9a Mon Sep 17 00:00:00 2001 From: "nelsonb%netscape.com" Date: Wed, 7 Feb 2001 02:06:05 +0000 Subject: [PATCH] When half-duplex applications (e.g. one thread per socket, doing alternate reading and writing) call PR_Send and PR_Recv with a non-infinite timeout value, use that value for both underlying read and write operations. Fixes bug 67402. Reviewed by Wan-Teh. git-svn-id: svn://10.0.0.236/trunk@86433 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/security/nss/lib/ssl/sslsock.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/mozilla/security/nss/lib/ssl/sslsock.c b/mozilla/security/nss/lib/ssl/sslsock.c index 3fc7c8ed465..f788003cf97 100644 --- a/mozilla/security/nss/lib/ssl/sslsock.c +++ b/mozilla/security/nss/lib/ssl/sslsock.c @@ -34,7 +34,7 @@ * may use your version of this file under either the MPL or the * GPL. * - * $Id: sslsock.c,v 1.10 2001-02-07 00:34:56 nelsonb%netscape.com Exp $ + * $Id: sslsock.c,v 1.11 2001-02-07 02:06:05 nelsonb%netscape.com Exp $ */ #include "seccomon.h" #include "cert.h" @@ -1138,6 +1138,8 @@ ssl_Recv(PRFileDesc *fd, void *buf, PRInt32 len, PRIntn flags, } SSL_LOCK_READER(ss); ss->rTimeout = timeout; + if (!ss->fdx) + ss->wTimeout = timeout; rv = (*ss->ops->recv)(ss, (unsigned char*)buf, len, flags); SSL_UNLOCK_READER(ss); return rv; @@ -1157,6 +1159,8 @@ ssl_Send(PRFileDesc *fd, const void *buf, PRInt32 len, PRIntn flags, } SSL_LOCK_WRITER(ss); ss->wTimeout = timeout; + if (!ss->fdx) + ss->rTimeout = timeout; rv = (*ss->ops->send)(ss, (const unsigned char*)buf, len, flags); SSL_UNLOCK_WRITER(ss); return rv; @@ -1175,6 +1179,8 @@ ssl_Read(PRFileDesc *fd, void *buf, PRInt32 len) } SSL_LOCK_READER(ss); ss->rTimeout = PR_INTERVAL_NO_TIMEOUT; + if (!ss->fdx) + ss->wTimeout = PR_INTERVAL_NO_TIMEOUT; rv = (*ss->ops->read)(ss, (unsigned char*)buf, len); SSL_UNLOCK_READER(ss); return rv; @@ -1193,6 +1199,8 @@ ssl_Write(PRFileDesc *fd, const void *buf, PRInt32 len) } SSL_LOCK_WRITER(ss); ss->wTimeout = PR_INTERVAL_NO_TIMEOUT; + if (!ss->fdx) + ss->rTimeout = PR_INTERVAL_NO_TIMEOUT; rv = (*ss->ops->write)(ss, (const unsigned char*)buf, len); SSL_UNLOCK_WRITER(ss); return rv;