Fix for Bug 56170 "After mac goes to sleep, getting IMAP mail locks up machine". Changed case kOTOutStateErr, so that it returns an error. This enables us to detect when a connection is closed out from under us. NSPRPUB_RELEASE_4_0_BRANCH
authorgordon%netscape.com
Fri, 13 Oct 2000 21:50:23 +0000
branchNSPRPUB_RELEASE_4_0_BRANCH
changeset 1599 3c821f22fb996eaf683440f821cdf13c6b1a9398
parent 1591 4c85d9d3b27c6e27fccfe4b847d18a17c03beadb
push idunknown
push userunknown
push dateunknown
bugs56170
Fix for Bug 56170 "After mac goes to sleep, getting IMAP mail locks up machine". Changed case kOTOutStateErr, so that it returns an error. This enables us to detect when a connection is closed out from under us.
pr/src/md/mac/macsockotpt.c
--- a/pr/src/md/mac/macsockotpt.c
+++ b/pr/src/md/mac/macsockotpt.c
@@ -1460,19 +1460,16 @@ static PRInt32 SendReceiveStream(PRFileD
 
         if (result > 0) {
             buf = (void *) ( (UInt32) buf + (UInt32)result );
             bytesLeft -= result;
             if (opCode == kSTREAM_RECEIVE)
                 return result;
         } else {
 			switch (result) {
-				case kOTOutStateErr:			// it has been closed
-                    return 0;
-				
 				case kOTLookErr:
 				    PR_ASSERT(!"call to OTLook() required after all.");
 					break;
 				
 				case kOTFlowErr:
 				case kOTNoDataErr:
 				case kEAGAINErr:
 				case kEWOULDBLOCKErr:
@@ -1482,16 +1479,17 @@ static PRInt32 SendReceiveStream(PRFileD
 					}
 
 					WaitOnThisThread(me, timeout);
 					err = me->md.osErrCode;
 					if (err != kOTNoError)
 						goto ErrorExit;				
 					break;
 					
+				case kOTOutStateErr:	// it has been closed, fall through for error
 				default:
 					err = result;
 					goto ErrorExit;
 			}
 		}
     }
 
     PR_ASSERT(opCode == kSTREAM_SEND ? fd->secret->md.write.thread == nil :