diff options
author | rpotts%netscape.com <devnull@localhost> | 2000-11-10 20:32:09 +0000 |
---|---|---|
committer | rpotts%netscape.com <devnull@localhost> | 2000-11-10 20:32:09 +0000 |
commit | f66ae5c2d0fcd2d85253323639ee9a08e92193e0 (patch) | |
tree | 28e2c00ae614390e30e9ed8f7a03f86fb191df3d | |
parent | 16c6e5a6a9fcb20fbd95c48abc79f5773e8be9be (diff) | |
download | nspr-hg-EMBEDDING_08042000_BRANCH.tar.gz |
Merging changes from the Netscape_20000922_BRANCH as of 2000-11-09 16:20:00EMBEDDING_08042000_BRANCH
-rw-r--r-- | pr/include/md/_macos.h | 2 | ||||
-rw-r--r-- | pr/src/md/mac/macsockotpt.c | 10 |
2 files changed, 6 insertions, 6 deletions
diff --git a/pr/include/md/_macos.h b/pr/include/md/_macos.h index 5bb4d72d..bcbca3c4 100644 --- a/pr/include/md/_macos.h +++ b/pr/include/md/_macos.h @@ -91,7 +91,7 @@ typedef struct _MDSocketCallerInfo { struct _MDFileDesc { PRInt32 osfd; - PRBool connectionOpen; + PRBool orderlyDisconnect; PRBool readReady; PRBool writeReady; PRBool exceptReady; diff --git a/pr/src/md/mac/macsockotpt.c b/pr/src/md/mac/macsockotpt.c index 72100272..1c9b7d19 100644 --- a/pr/src/md/mac/macsockotpt.c +++ b/pr/src/md/mac/macsockotpt.c @@ -325,7 +325,6 @@ static pascal void NotifierRoutine(void * contextPtr, OTEventCode code, OTResul thread = secret->md.write.thread; secret->md.write.thread = NULL; secret->md.write.cookie = cookie; - secret->md.connectionOpen = PR_TRUE; break; case T_DATA: // Standard data is available @@ -347,7 +346,6 @@ static pascal void NotifierRoutine(void * contextPtr, OTEventCode code, OTResul err = OTRcvDisconnect(endpoint, &discon); PR_ASSERT(err == kOTNoError); secret->md.exceptReady = PR_TRUE; - secret->md.connectionOpen = PR_FALSE; // wake up waiting threads, if any result = -3199 - discon.reason; // obtain the negative error code @@ -380,7 +378,7 @@ static pascal void NotifierRoutine(void * contextPtr, OTEventCode code, OTResul PR_ASSERT(err == kOTNoError); secret->md.readReady = PR_TRUE; // mark readable (to emulate bsd sockets) // remember connection is closed, so we can return 0 on read or receive - secret->md.connectionOpen = PR_FALSE; + secret->md.orderlyDisconnect = PR_TRUE; thread = secret->md.read.thread; secret->md.read.thread = NULL; @@ -1484,7 +1482,9 @@ static PRInt32 SendReceiveStream(PRFileDesc *fd, void *buf, PRInt32 amount, goto ErrorExit; break; - case kOTOutStateErr: // it has been closed, fall through for error + case kOTOutStateErr: // if provider already closed, fall through to handle error + if (fd->secret->md.orderlyDisconnect) + return 0; default: err = result; goto ErrorExit; @@ -1777,7 +1777,7 @@ void _MD_initfiledesc(PRFileDesc *fd) PR_ASSERT(fd->secret->md.miscLock == NULL); fd->secret->md.miscLock = PR_NewLock(); PR_ASSERT(fd->secret->md.miscLock != NULL); - fd->secret->md.connectionOpen = PR_FALSE; // starts out closed + fd->secret->md.orderlyDisconnect = PR_FALSE; fd->secret->md.readReady = PR_FALSE; // let's not presume we have data ready to read fd->secret->md.writeReady = PR_TRUE; // let's presume we can write unless we hear otherwise fd->secret->md.exceptReady = PR_FALSE; |