Bug 710176, Part 2: Import ssl_Poll fix from bug 542832, r=kaie

This commit is contained in:
Brian Smith 2012-01-31 04:24:16 -08:00
parent 42c3625e9a
commit 0b84714b2a
3 changed files with 57 additions and 2 deletions

View File

@ -1955,7 +1955,21 @@ ssl_Poll(PRFileDesc *fd, PRInt16 how_flags, PRInt16 *p_out_flags)
} else if ((ss->lastWriteBlocked) && (how_flags & PR_POLL_READ) &&
(ss->pendingBuf.len != 0)) { /* write data waiting to be sent */
new_flags |= PR_POLL_WRITE; /* also select on write. */
}
}
if (ss->version >= SSL_LIBRARY_VERSION_3_0 &&
ss->ssl3.hs.restartTarget != NULL) {
/* Read and write will block until the asynchronous callback completes
* (e.g. until SSL_AuthCertificateComplete is called), so don't tell
* the caller to poll the socket unless there is pending write data.
*/
if (ss->lastWriteBlocked && ss->pendingBuf.len != 0) {
new_flags &= (PR_POLL_WRITE | PR_POLL_EXCEPT);
} else {
new_flags = 0;
}
}
if (new_flags && (fd->lower->methods->poll != NULL)) {
PRInt16 lower_out_flags = 0;
PRInt16 lower_new_flags;

View File

@ -4,5 +4,6 @@ on top of the NSS release.
bug-542832-ssl-restart-4.patch and bug-542832-ssl-restart-tstclnt-4.patch were
added so that we could test the new PSM SSL threading code (bug 674147) and
SPDY (bug 528288). bug-717906-lowhash was added to fix an issue with recent
Mozilla builds on fedora. These patches will be removed when the NSS 3.13.2
Mozilla builds on fedora. bug-710176-ssl-restart-7-poll-v5.patch were added
to fix a bug 710176. These patches will be removed when the NSS 3.13.2
release that includes them is imported into mozilla-central.

View File

@ -0,0 +1,40 @@
# HG changeset patch
# Parent 4560e2c22b83f85f9238b9094de7a190042676df
# User Brian Smith <bsmith@mozilla.com>
diff --git a/security/nss/lib/ssl/sslsock.c b/security/nss/lib/ssl/sslsock.c
--- a/security/nss/lib/ssl/sslsock.c
+++ b/security/nss/lib/ssl/sslsock.c
@@ -1950,17 +1950,31 @@ ssl_Poll(PRFileDesc *fd, PRInt16 how_fla
}
}
} else if ((new_flags & PR_POLL_READ) && (SSL_DataPending(fd) > 0)) {
*p_out_flags = PR_POLL_READ; /* it's ready already. */
return new_flags;
} else if ((ss->lastWriteBlocked) && (how_flags & PR_POLL_READ) &&
(ss->pendingBuf.len != 0)) { /* write data waiting to be sent */
new_flags |= PR_POLL_WRITE; /* also select on write. */
- }
+ }
+
+ if (ss->version >= SSL_LIBRARY_VERSION_3_0 &&
+ ss->ssl3.hs.restartTarget != NULL) {
+ /* Read and write will block until the asynchronous callback completes
+ * (e.g. until SSL_AuthCertificateComplete is called), so don't tell
+ * the caller to poll the socket unless there is pending write data.
+ */
+ if (ss->lastWriteBlocked && ss->pendingBuf.len != 0) {
+ new_flags &= (PR_POLL_WRITE | PR_POLL_EXCEPT);
+ } else {
+ new_flags = 0;
+ }
+ }
+
if (new_flags && (fd->lower->methods->poll != NULL)) {
PRInt16 lower_out_flags = 0;
PRInt16 lower_new_flags;
lower_new_flags = fd->lower->methods->poll(fd->lower, new_flags,
&lower_out_flags);
if ((lower_new_flags & lower_out_flags) && (how_flags != new_flags)) {
PRInt16 out_flags = lower_out_flags & ~PR_POLL_RW;
if (lower_out_flags & PR_POLL_READ)