summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgordon%netscape.com <devnull@localhost>2000-11-01 22:45:55 +0000
committergordon%netscape.com <devnull@localhost>2000-11-01 22:45:55 +0000
commitd6aa1a030e8a87e062738eb328652c412e76903b (patch)
tree901444eb4aaca46a9cc1247fbb260b52be2b1737
parent694c7c3e476cb80ac77a0e4b021e5ab8d7fd69e4 (diff)
downloadnspr-hg-Netscape_20000922_BRANCH.tar.gz
Fix for Bugscape 3003. Modified SendReceiveStream to differentiate OrderlyDisconnects from Endpoint destruction due to sleep or tcp setting changes.Netscape_20000922_BRANCH
r=sdagley, wtc, sr=sfraser.
-rw-r--r--pr/include/md/_macos.h2
-rw-r--r--pr/src/md/mac/macsockotpt.c10
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;