Revision: 41718
          http://brlcad.svn.sourceforge.net/brlcad/?rev=41718&view=rev
Author:   davidloman
Date:     2010-12-20 14:39:02 +0000 (Mon, 20 Dec 2010)

Log Message:
-----------
Ah ha!  Found the bug that was causing the restart issues 
(login->logout->login).  Turns out that the FD for the incoming connection was 
ONLY added to the master FD Set *if* the new FD was set as MAXFD.  Unrolled the 
logic accordingly.

Modified Paths:
--------------
    rt^3/trunk/src/libNet/PortalManager.cxx

Modified: rt^3/trunk/src/libNet/PortalManager.cxx
===================================================================
--- rt^3/trunk/src/libNet/PortalManager.cxx     2010-12-20 13:42:06 UTC (rev 
41717)
+++ rt^3/trunk/src/libNet/PortalManager.cxx     2010-12-20 14:39:02 UTC (rev 
41718)
@@ -111,7 +111,7 @@
                /* Shelect!! */
                int retVal = select(fdmax + 1, &readfds, NULL, &exceptionfds, 
&timeout);
 
-               /**/
+               /*  */
                if (retVal != 0) {
                        QString out("Select returned: ");
                        out.append(QString::number(retVal));
@@ -121,7 +121,7 @@
                        out.append(QString::number(fdmax));
                        this->log->logINFO("PortalManager", out);
                }
-                /**/
+                /*  */
 
                if (retVal < 0) {
                        /* got a selector error */
@@ -134,18 +134,18 @@
                for (int i = 0; i <= fdmax; ++i) {
                        bool isaFD = FD_ISSET(i, &masterfds);
 
-                       /* Don't muck with an FD that isn't ours!*/
+                       /* Don't muck with an FD that isn't ours! */
                        if (!isaFD) {
                                continue;
                        }
 
-                       /* Simplify switching later with bools now*/
+                       /* Simplify switching later with bools now */
                        isListener = (i == listener);
-                       readyRead = true; /*FD_ISSET(i, &readfds) && 
!isListener;*/
+                       readyRead = true; /* FD_ISSET(i, &readfds) && 
!isListener; */
                        readyAccept = FD_ISSET(i, &readfds) && isListener;
                        readyException = FD_ISSET(i, &exceptionfds);
 
-                       /* If nothing to do, then continue;*/
+                       /* If nothing to do, then continue; */
                        if (!readyRead && !readyAccept && !readyException) {
                                continue;
                        }
@@ -237,12 +237,14 @@
 
        /* Check maxFD and update if needed. */
        if (newFD > fdmax) {
-               this->masterFDSLock.lock();
-               FD_SET(newFD, &masterfds);
                fdmax = newFD;
-               this->masterFDSLock.unlock();
        }
 
+       /* Add to masterFDS. */
+       this->masterFDSLock.lock();
+       FD_SET(newFD, &masterfds);
+       this->masterFDSLock.unlock();
+
        p->sendGSNodeName();
 
        return p;
@@ -317,6 +319,7 @@
 
        this->disconnect(origin);
 }
+
 /*
  * Local Variables:
  * mode: C


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
Lotusphere 2011
Register now for Lotusphere 2011 and learn how
to connect the dots, take your collaborative environment
to the next level, and enter the era of Social Business.
http://p.sf.net/sfu/lotusphere-d2d
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to