summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormozilla.BenB%bucksch.org <devnull@localhost>2002-12-15 19:05:51 +0000
committermozilla.BenB%bucksch.org <devnull@localhost>2002-12-15 19:05:51 +0000
commitfa7c8e11d1ecac697276e388789fee68e8035397 (patch)
tree9429c97c34f87f186d823d51a3bbd272762a0bdc
parentf46bd80972619c035122a604bf9ca1bcaa7cf7f2 (diff)
downloadnspr-hg-BEONEX_0_8_BRANCH.tar.gz
Updating to Mozilla 1.0 branch, i.e. merging changes between Mozilla 1.0.1 and Mozilla 1.0.2 into Beonex Communicator 0.8.xBEONEX_0_8_2_0_RELEASEBEONEX_0_8_BRANCH
-rw-r--r--pr/src/md/mac/macsockotpt.c29
1 files changed, 16 insertions, 13 deletions
diff --git a/pr/src/md/mac/macsockotpt.c b/pr/src/md/mac/macsockotpt.c
index 42462740..6c54de4c 100644
--- a/pr/src/md/mac/macsockotpt.c
+++ b/pr/src/md/mac/macsockotpt.c
@@ -1776,6 +1776,8 @@ static PRInt32 CheckPollDescMethods(PRPollDesc *pds, PRIntn npds, PRInt16 *outRe
PRInt16 in_flags_read = 0, in_flags_write = 0;
PRInt16 out_flags_read = 0, out_flags_write = 0;
+ pd->out_flags = 0;
+
if (NULL == pd->fd || pd->in_flags == 0) continue;
if (pd->in_flags & PR_POLL_READ)
@@ -1823,14 +1825,17 @@ static PRInt32 CheckPollDescEndpoints(PRPollDesc *pds, PRIntn npds, const PRInt1
if (NULL == pd->fd || pd->in_flags == 0) continue;
+ if ((pd->in_flags & ~pd->out_flags) == 0) {
+ ready++;
+ continue;
+ }
+
bottomFD = PR_GetIdentitiesLayer(pd->fd, PR_NSPR_IO_LAYER);
/* bottomFD can be NULL for pollable sockets */
if (bottomFD)
{
if (_PR_FILEDESC_OPEN == bottomFD->secret->state)
{
- pd->out_flags = 0; /* pre-condition */
-
if (GetState(bottomFD, &readReady, &writeReady, &exceptReady))
{
if (readReady)
@@ -1851,8 +1856,8 @@ static PRInt32 CheckPollDescEndpoints(PRPollDesc *pds, PRIntn npds, const PRInt1
{
pd->out_flags |= PR_POLL_EXCEPT;
}
- if (0 != pd->out_flags) ready++;
}
+ if (0 != pd->out_flags) ready++;
}
else /* bad state */
{
@@ -1948,13 +1953,14 @@ PRInt32 _MD_poll(PRPollDesc *pds, PRIntn npds, PRIntervalTime timeout)
writeFlags = &ioFlags[npds];
}
- if (timeout != PR_INTERVAL_NO_WAIT) {
+ // we have to be outside the lock when calling this, since
+ // it can call arbitrary user code (including other socket
+ // entry points)
+ ready = CheckPollDescMethods(pds, npds, readFlags, writeFlags);
+
+ if (!ready && timeout != PR_INTERVAL_NO_WAIT) {
intn is;
- // we have to be outside the lock when calling this, since
- // it can call arbitrary user code (including other socket
- // entry points)
- (void)CheckPollDescMethods(pds, npds, readFlags, writeFlags);
_PR_INTSOFF(is);
PR_Lock(thread->md.asyncIOLock);
@@ -1975,17 +1981,14 @@ PRInt32 _MD_poll(PRPollDesc *pds, PRIntn npds, PRIntervalTime timeout)
// since we may have been woken by a pollable event firing,
// we have to check both poll methods and endpoints.
(void)CheckPollDescMethods(pds, npds, readFlags, writeFlags);
- (void)CheckPollDescEndpoints(pds, npds, readFlags, writeFlags);
- ready = CountReadyPollDescs(pds, npds);
+ ready = CheckPollDescEndpoints(pds, npds, readFlags, writeFlags);
}
thread->io_pending = PR_FALSE;
SetDescPollThread(pds, npds, NULL);
}
else {
- (void)CheckPollDescMethods(pds, npds, readFlags, writeFlags);
- (void)CheckPollDescEndpoints(pds, npds, readFlags, writeFlags);
- ready = CountReadyPollDescs(pds, npds);
+ ready = CheckPollDescEndpoints(pds, npds, readFlags, writeFlags);
}
if (readFlags != readFlagsArray)