ayttm-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Ayttm-commits] CVS: ayttm/modules/msn2/libmsn2 msn_bittybits.C,1.9,1.10


From: Colin Leroy <address@hidden>
Subject: [Ayttm-commits] CVS: ayttm/modules/msn2/libmsn2 msn_bittybits.C,1.9,1.10
Date: Tue, 25 Mar 2003 08:03:30 -0500

Update of /cvsroot/ayttm/ayttm/modules/msn2/libmsn2
In directory subversions:/tmp/cvs-serv21476/modules/msn2/libmsn2

Modified Files:
        msn_bittybits.C 
Log Message:
ndle the unlikely case where the conn could be closed during
the read loop


Index: msn_bittybits.C
===================================================================
RCS file: /cvsroot/ayttm/ayttm/modules/msn2/libmsn2/msn_bittybits.C,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- msn_bittybits.C     25 Mar 2003 12:51:31 -0000      1.9
+++ msn_bittybits.C     25 Mar 2003 13:03:28 -0000      1.10
@@ -38,18 +38,20 @@
     should_terminate = 0;
     if(read(sock, &c, 1)<1)
     {
-      if (errno == EAGAIN) {
+      if (errno == EAGAIN) {  
 #ifdef __MINGW32__
        int j;
        for (int i=0; i<10000000;i++)
                j=i;
 #else
-       printf("EAGAIN,  sleeping\n");
-       if(poll(&pfd,1,1000)==0) {
+       int res=0;
+       if((res=poll(&pfd,1,1000))==0) {
                should_terminate = 1;
                break;
-       } else 
+       } else if (res > 0) {
                continue;
+       } else
+               return NULL;
        
 #endif
        continue;
@@ -66,10 +68,16 @@
     buf[pos]=c;
     pos++;
 #ifndef __WINGW32__
-    if(poll(&pfd,1,0)==0) {
-           printf("nothing available sleeping\n");
-           should_terminate=1;
-           poll(&pfd,1,1000);
+    {
+           int res = 0;
+           if((res=poll(&pfd,1,0))==0) {
+                   should_terminate=1;
+                   res=poll(&pfd,1,1000);
+           } 
+           if (res < 0) {
+               printf("uh, msnconn closed\n");    
+               return NULL;
+           }
     }
 #endif
   }





reply via email to

[Prev in Thread] Current Thread [Next in Thread]