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. Netscape_20000922_BRANCH Netscape_20001027_RELEASE Netscape_20001030_RELEASE Netscape_20001031_RELEASE Netscape_2000_1030_RELEASE
authorgordon%netscape.com
Fri, 13 Oct 2000 21:16:30 +0000
branchNetscape_20000922_BRANCH
changeset 1597 7403d34074273b83947e7f26b4179ff4c55fc100
parent 1593 53dc46cd82663c53a6f9d67de0ca2eeb71ef3d70
child 1613 1c2bf754e11135f821cd1d7d9a4a2570c514faca
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 :