Add some logging, fix reversed conditional
authorcantor <cantor@cb58f699-b61c-0410-a6fe-9272a202ed29>
Fri, 19 Mar 2004 02:45:59 +0000 (02:45 +0000)
committercantor <cantor@cb58f699-b61c-0410-a6fe-9272a202ed29>
Fri, 19 Mar 2004 02:45:59 +0000 (02:45 +0000)
git-svn-id: https://svn.middleware.georgetown.edu/cpp-sp/trunk@875 cb58f699-b61c-0410-a6fe-9272a202ed29

shar/shar-utils.cpp
shar/shar.cpp

index edcbf70..d57770e 100644 (file)
@@ -104,7 +104,7 @@ void SharChild::run()
 {
   NDC ndc("run");
   if (SHARUtils::shar_create_svc(sock, v_protos) != 0)
-    return;
+   return;
 
   fd_set readfds;
   struct timeval tv = { 0, 0 };
index 80c995f..d1f1474 100644 (file)
 #include <signal.h>
 
 #include "shar-utils.h"
+#include <log4cpp/Category.hh>
 
 using namespace std;
 using namespace saml;
 using namespace shibboleth;
 using namespace shibtarget;
+using namespace log4cpp;
 
 #ifndef FD_SETSIZE
 # define FD_SETSIZE 1024
@@ -95,7 +97,7 @@ static bool new_connection(IListener::ShibSocket& listener, const Iterator<ShibR
     IListener::ShibSocket sock;
 
     // Accept the connection.
-    if (ShibTargetConfig::getConfig().getINI()->getListener()->accept(listener, sock))
+    if (!ShibTargetConfig::getConfig().getINI()->getListener()->accept(listener, sock))
         return false;
 
     // We throw away the result because the children manage themselves...
@@ -106,6 +108,7 @@ static bool new_connection(IListener::ShibSocket& listener, const Iterator<ShibR
 static void shar_svc_run(IListener::ShibSocket& listener, const Iterator<ShibRPCProtocols>& protos)
 {
     NDC ndc("shar_svc_run");
+    Category& log=Category::getInstance("SHAR");
 
     while (shar_run) {
         fd_set readfds;
@@ -124,10 +127,11 @@ static void shar_svc_run(IListener::ShibSocket& listener, const Iterator<ShibRPC
                 continue;
         
             default:
-                new_connection(listener, protos);
+                if (!new_connection(listener, protos))
+                    log.error("new_connection failed");
         }
     }
-    printf("shar_svc_run ended\n");
+    log.info("shar_svc_run ended");
 }
 
 #ifdef WIN32