Fix bug 72038 "FTP listings never stop loading on Mac", by sfraser and gordon. r= dougt, sr=scc.
authorgordon%netscape.com
Fri, 16 Mar 2001 22:00:13 +0000
changeset 1783 dcad374d78853707911a181839ac61b62436e3e0
parent 1780 92eb0bdaf941c179fd618dd2d860eb94a14a7961
child 1785 ed8405421041f98fa694acd05b403961137c63c8
push idunknown
push userunknown
push dateunknown
reviewersscc
bugs72038
Fix bug 72038 "FTP listings never stop loading on Mac", by sfraser and gordon. r= dougt, sr=scc.
pr/src/md/mac/macsockotpt.c
--- a/pr/src/md/mac/macsockotpt.c
+++ b/pr/src/md/mac/macsockotpt.c
@@ -1675,20 +1675,23 @@ PRInt32 _MD_writev(PRFileDesc *fd, const
     _PR_MD_CURRENT_THREAD()->md.osErrCode = unimpErr;
     return -1;
 }                               
 
 
 static PRBool GetState(PRFileDesc *fd, PRBool *readReady, PRBool *writeReady, PRBool *exceptReady)
 {
     OTResult resultOT;
-	size_t   availableData;
-    
-	resultOT = OTCountDataBytes((EndpointRef)fd->secret->md.osfd, &availableData);   
-	*readReady = fd->secret->md.readReady && (availableData > 0);
+    // hack to emulate BSD sockets; say that a socket that has disconnected
+    // is still readable.
+    size_t   availableData = 1;
+    if (!fd->secret->md.orderlyDisconnect)
+        OTCountDataBytes((EndpointRef)fd->secret->md.osfd, &availableData);
+
+    *readReady = fd->secret->md.readReady && (availableData > 0);
 	*exceptReady = fd->secret->md.exceptReady;
 
     resultOT = OTGetEndpointState((EndpointRef)fd->secret->md.osfd);
     switch (resultOT)    {
         case T_DATAXFER:
         case T_INREL:
             *writeReady = PR_TRUE;
             break;