fix for bug 66508. r=pinkerton, sr=sfraser. Landing fix from 6.0 branch to detect orderlyDisconnects.

git-svn-id: svn://10.0.0.236/branches/NSPRPUB_CLIENT_BRANCH@86406 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
gordon%netscape.com
2001-02-07 01:03:35 +00:00
parent 256c406850
commit 3bfde4bd37
2 changed files with 6 additions and 6 deletions

View File

@@ -91,7 +91,7 @@ typedef struct _MDSocketCallerInfo {
struct _MDFileDesc {
PRInt32 osfd;
PRBool connectionOpen;
PRBool orderlyDisconnect;
PRBool readReady;
PRBool writeReady;
PRBool exceptReady;

View File

@@ -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 to handle 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;