Revision: 40617
          http://brlcad.svn.sourceforge.net/brlcad/?rev=40617&view=rev
Author:   davidloman
Date:     2010-09-20 18:54:07 +0000 (Mon, 20 Sep 2010)

Log Message:
-----------
Move generation of the pkg_switch table over into the Portal class.  Since we 
are using a static fn in Portal to springboard the callback, we no longer need 
centralized generation of the table prior to Portal init.

Modified Paths:
--------------
    rt^3/trunk/include/PkgServer.h
    rt^3/trunk/src/libPkgCpp/PkgServer.cxx

Modified: rt^3/trunk/include/PkgServer.h
===================================================================
--- rt^3/trunk/include/PkgServer.h      2010-09-20 18:48:40 UTC (rev 40616)
+++ rt^3/trunk/include/PkgServer.h      2010-09-20 18:54:07 UTC (rev 40617)
@@ -32,12 +32,10 @@
 class PkgServer
 {
 public:
-  PkgServer(std::string proto, pkg_switch callbacks[]);
-  virtual
-  ~PkgServer();
+  PkgServer(std::string proto);
+  virtual ~PkgServer();
 
-  bool
-  listen(unsigned short port);
+  bool listen(unsigned short port);
 
   /*
    * This function blocks if waitTime is set to '0'.  '0' is default.
@@ -48,7 +46,6 @@
 private:
   std::string proto;
   int listenFD;
-  pkg_switch* callBackTable;
 
   virtual PkgClient*
   getNewClient(pkg_conn* conn) = 0;

Modified: rt^3/trunk/src/libPkgCpp/PkgServer.cxx
===================================================================
--- rt^3/trunk/src/libPkgCpp/PkgServer.cxx      2010-09-20 18:48:40 UTC (rev 
40616)
+++ rt^3/trunk/src/libPkgCpp/PkgServer.cxx      2010-09-20 18:54:07 UTC (rev 
40617)
@@ -28,10 +28,9 @@
 #include <stdio.h>
 #include <unistd.h>
 
-PkgServer::PkgServer(std::string proto, struct pkg_switch* callBackTableIn)
+PkgServer::PkgServer(std::string proto)
 {
   this->proto = proto;
-  this->callBackTable = callBackTableIn;
 }
 
 PkgServer::~PkgServer()
@@ -59,23 +58,26 @@
 
 PkgClient*
 PkgServer::waitForClient(int waitTime) {
-       pkg_conn* clientStruct = pkg_getclient(this->listenFD, 
this->callBackTable,
-                       NULL, waitTime);
-       if (clientStruct == PKC_NULL) {
-               if (waitTime == 0) {
-                       bu_log("Connection seems to be busy, waiting...\n");
-                       usleep(100);
-               }
-               return NULL;
-       } else if (clientStruct == PKC_ERROR) {
-               //Fatal error accepting client connection
-               bu_log("Fatal error accepting client connection.\n");
-               pkg_close(clientStruct);
-               return NULL;
-       }
+       pkg_conn* clientStruct = pkg_getclient(this->listenFD, NULL, NULL, 
waitTime);
+  if (clientStruct == PKC_NULL)
+    {
+      if (waitTime == 0)
+        {
+          bu_log("Connection seems to be busy, waiting...\n");
+          usleep(100);
+        }
+      return NULL;
+    }
+  else if (clientStruct == PKC_ERROR)
+    {
+      //Fatal error accepting client connection
+      bu_log("Fatal error accepting client connection.\n");
+      pkg_close(clientStruct);
+      return NULL;
+    }
 
-       PkgClient* pkgClientObj = this->getNewClient(clientStruct);
-       return pkgClientObj;
+  PkgClient* pkgClientObj = this->getNewClient(clientStruct);
+  return pkgClientObj;
 }
 
 /*


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

------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to