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.
authorgordon%netscape.com
Fri, 13 Oct 2000 21:49:44 +0000
changeset 1598 388bbf19d413112142ebc545d120a49df8323f93
parent 1592 d6e5355c5a0020c243cea1f993b4904b763fa129
child 1602 6e71b2d13b489bae199a63c2e6272b0f0d271eb5
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
@@ -1477,19 +1477,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:
@@ -1499,16 +1496,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 :