Fix for Mac OT bugs #4251. Added a case for OTGetEndpointState() returning T_INREL to avoid calling PR_ASSERT. Also removed call to macsock_map_error() in notification routine because it makes assumptions concerning the current thread that are not valid from an interrupt. NSPRPUB_RELEASE_3_1_BRANCH
authorgordon%netscape.com
Tue, 27 Apr 1999 19:54:21 +0000
branchNSPRPUB_RELEASE_3_1_BRANCH
changeset 588 6c36cec8e8d0af511e1e885e174ed7d804da62d5
parent 579 9e5b1d6c21b017b12953a362428cde800b745a32
child 589 21f925c7d143e4edb9e606c3491395a842d5221f
push idunknown
push userunknown
push dateunknown
Fix for Mac OT bugs #4251. Added a case for OTGetEndpointState() returning T_INREL to avoid calling PR_ASSERT. Also removed call to macsock_map_error() in notification routine because it makes assumptions concerning the current thread that are not valid from an interrupt. This syncs with macsockotpt.c 3.9 on the tip.
pr/src/md/mac/macsockotpt.c
--- a/pr/src/md/mac/macsockotpt.c
+++ b/pr/src/md/mac/macsockotpt.c
@@ -1,12 +1,12 @@
 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /*
  * The contents of this file are subject to the Netscape Public License
- * Version 1.0 (the "NPL"); you may not use this file except in
+ * Version 1.1 (the "NPL"); you may not use this file except in
  * compliance with the NPL.  You may obtain a copy of the NPL at
  * http://www.mozilla.org/NPL/
  * 
  * Software distributed under the NPL is distributed on an "AS IS" basis,
  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
  * for the specific language governing rights and limitations under the
  * NPL.
  * 
@@ -208,17 +208,16 @@ static void PrepareForAsyncCompletion(PR
 // A5 is OK. Cannot allocate memory here
 pascal void  NotifierRoutine(void * contextPtr, OTEventCode code, OTResult result, void * cookie)
 {
 	PRFileDesc *  fd       = (PRFileDesc *) contextPtr;
 	EndpointRef   endpoint = (EndpointRef)fd->secret->md.osfd;
     PRThread *    thread   = NULL;
     _PRCPU *      cpu      = _PR_MD_CURRENT_CPU(); 
 	OSStatus      err;
-    TDiscon       discon;
 	OTResult	  resultOT;
 
     switch (code)
     {
 // OTLook Events - 
         case T_LISTEN:        // A connection request is available
             PR_ASSERT(!"T_LISTEN Not implemented");  // listen or reject?
             break;
@@ -244,20 +243,18 @@ pascal void  NotifierRoutine(void * cont
             fd->secret->md.read.cookie    = cookie;
 			break;
 
         case T_EXDATA:      // Expedited data is available
             PR_ASSERT(!"T_EXDATA Not implemented");
 			return;
 
         case T_DISCONNECT:  // A disconnect is available
-            memset(&discon, 0 , sizeof(discon));
-            err = OTRcvDisconnect(endpoint, &discon);
+            err = OTRcvDisconnect(endpoint, NULL);
             PR_ASSERT(err == kOTNoError);
-            macsock_map_error(discon.reason);
             fd->secret->md.exceptReady     = PR_TRUE;
             fd->secret->md.connectionOpen  = PR_FALSE;
             break;
 		
         case T_ERROR:       // obsolete/unused in library
             PR_ASSERT(!"T_ERROR Not implemented");
 			return;		
 		
@@ -1711,13 +1708,16 @@ int _MD_mac_get_nonblocking_connect_erro
     switch (resultOT)    {
         case T_OUTCON:
             macsock_map_error(EINPROGRESS);
             return -1;
         case T_DATAXFER:
             return 0;
         case T_IDLE:
             return -1;
+        case T_INREL:
+        	macsock_map_error(ENOTCONN);
+        	return -1;
         default:
             PR_ASSERT(0);
             return -1;
     }
 }