Add some shutdown code
authorcantor <cantor@cb58f699-b61c-0410-a6fe-9272a202ed29>
Wed, 6 Apr 2005 18:41:17 +0000 (18:41 +0000)
committercantor <cantor@cb58f699-b61c-0410-a6fe-9272a202ed29>
Wed, 6 Apr 2005 18:41:17 +0000 (18:41 +0000)
git-svn-id: https://svn.middleware.georgetown.edu/cpp-sp/trunk@1513 cb58f699-b61c-0410-a6fe-9272a202ed29

shar/shar.cpp

index 692b46a..3d9b73f 100644 (file)
@@ -193,12 +193,16 @@ int real_main(int preinit)
         const IListener* listener=conf.getINI()->getListener();
         
         // Create the SHAR listener socket
-        if (!listener->create(sock))
+        if (!listener->create(sock)) {
+            conf.shutdown();
             return -3;
+        }
 
         // Bind to the proper port
-        if (!listener->bind(sock))
+        if (!listener->bind(sock)) {
+            conf.shutdown();
             return -4;
+        }
 
         // Initialize the SHAR Utilitites
         SHARUtils::init();
@@ -215,7 +219,7 @@ int real_main(int preinit)
         }
 
         conf.shutdown();
-        fprintf(stdout, "shar shutdown complete\n");
+        fprintf(stdout, "shibd shutdown complete\n");
     }
     return 0;
 }
@@ -345,12 +349,16 @@ int main(int argc, char *argv[])
         const IListener* listener=conf.getINI()->getListener();
         
         // Create the SHAR listener socket
-        if (!listener->create(sock))
+        if (!listener->create(sock)) {
+            conf.shutdown();
             return -3;
+        }
     
         // Bind to the proper port
-        if (!listener->bind(sock, unlink_socket==1))
+        if (!listener->bind(sock, unlink_socket==1)) {
+            conf.shutdown();
             return -4;
+        }
     
         // Initialize the SHAR Utilitites
         SHARUtils::init();
@@ -365,9 +373,9 @@ int main(int argc, char *argv[])
         listener->close(sock);
         fprintf(stderr, "shib socket closed\n");
     }
-    
+
     conf.shutdown();
-    fprintf(stderr, "shar shutdown complete\n");
+    fprintf(stderr, "shibd shutdown complete\n");
     return 0;
 }