dragonmtn-commits
[Top][All Lists]
Advanced

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

[Dragonmtn-commits] Changes to snowwhite/main.c


From: Mark Loeser
Subject: [Dragonmtn-commits] Changes to snowwhite/main.c
Date: Sat, 16 Apr 2005 17:29:50 -0400

Index: snowwhite/main.c
diff -u snowwhite/main.c:1.3 snowwhite/main.c:1.4
--- snowwhite/main.c:1.3        Sat Apr 16 21:15:39 2005
+++ snowwhite/main.c    Sat Apr 16 21:29:44 2005
@@ -8,7 +8,7 @@
  * \wd \taz \greg \mysid
  * \date 1996-2001
  *
- * $Id: main.c,v 1.3 2005/04/16 21:15:39 Halcy0n Exp $
+ * $Id: main.c,v 1.4 2005/04/16 21:29:44 Halcy0n Exp $
  */
 
 /*
@@ -54,10 +54,6 @@
 
 #include <getopt.h>
 
-#ifdef USE_SQL
-extern PGconn *dbConn;
-#endif
-
 extern int svcOptFork;
 
 /*
@@ -145,9 +141,6 @@
        struct timeval tv;
        int cc;
        time_t next_alert_update = 0;
-#ifdef USE_SQL
-       int PQsockfd;
-#endif
 #ifndef NORLIMIT
        struct rlimit corelim;
 #endif
@@ -385,33 +378,6 @@
 
        dlogEntry("Connecting to server %s, port %d", hostname, port);
 
-#ifdef USE_SQL
-       if (dbConn != NULL)
-               PQfinish(dbConn);
-       dbConn = PQconnectdb(""
-#ifdef SQL_HOST
-                                                " host=" SQL_HOST
-#endif
-#ifdef SQL_HOSTADDR
-                                                " hostaddr=" SQL_HOSTADDR
-#endif
-#ifdef SQL_PORT
-                                                " port=" SQL_PORT
-#endif
-                                                " dbname=" SQL_DB
-                                                " user=" SQL_USER " password=" 
SQL_PASS "");
-       if (!dbConn) {
-               fprintf(stderr,
-                               "Error allocating memory for database 
connection.\n");
-               sshutdown(-1);
-       }
-       if (PQstatus(dbConn) != CONNECTION_OK) {
-               fprintf(stderr, "Error connecting to the database.\n");
-               sshutdown(-1);
-       }
-       PQsetnonblocking(dbConn, TRUE);
-#endif
-
        srand48(time(NULL));
        srandom(time(NULL));
 
@@ -505,14 +471,6 @@
                FD_ZERO(&writeme);
                FD_ZERO(&xceptme);
                FD_SET(server, &readme);
-#ifdef USE_SQL
-               if (dbConn) {
-                       PQsockfd = PQsocket(dbConn);
-                       PQflush(dbConn);
-                       FD_SET(PQsockfd, &readme);
-                       FD_SET(PQsockfd, &xceptme);
-               }
-#endif
                memset(buffer, 0, sizeof(buffer));
 
 
@@ -521,13 +479,7 @@
                 * wait for something interesting.
                 */
 
-#ifdef USE_SQL
-               cc =
-                       select(MAX(server, PQsockfd) + 1, &readme, &writeme, 
&xceptme,
-                                  &tv);
-#else
                cc = select(server + 1, &readme, &writeme, &xceptme, &tv);
-#endif
 
                /*
                 * select error is fatal
@@ -548,43 +500,6 @@
                if (next_alert_update < CTime)
                        next_alert_update = updateCloneAlerts(CTime);
 
-#ifdef USE_SQL
-               if (dbConn) {
-                       if (FD_ISSET(PQsockfd, &xceptme)
-                               || FD_ISSET(PQsockfd, &readme)) {
-                               switch (PQstatus(dbConn)) {
-                               default:
-                                       break;
-                               case CONNECTION_BAD:
-                                       logDump(corelog,
-                                                       "DB connection went 
bad, attempting to reset...");
-                                       sSend
-                                               ("GLOBOPS :DB connection went 
bad, attempting to reset...");
-                                       PQreset(dbConn);
-                                       if (PQstatus(dbConn) != CONNECTION_OK) {
-                                               logDump(corelog,
-                                                               "Unable to 
re-establish db connection, dying.");
-                                               sSend
-                                                       ("GLOBOPS :Unable to 
re-establish db connection, dying.");
-                                               sshutdown(-1);
-                                       }
-                                       break;
-                               }
-                       }
-
-                       if (FD_ISSET(PQsockfd, &readme)) {
-                               PGresult *res;
-
-                               PQconsumeInput(dbConn);
-                               if (!PQisBusy(dbConn)) {
-                               }
-                               while ((res = PQgetResult(dbConn))) {
-                                       PQclear(res);
-                               }
-                       }
-               }
-#endif
-
                /*
                 * receive one less than the size of the buffer, just in case...
                 */
@@ -643,4 +558,4 @@
 
 /**********************************************************************/
 
-/* $Id: main.c,v 1.3 2005/04/16 21:15:39 Halcy0n Exp $ */
+/* $Id: main.c,v 1.4 2005/04/16 21:29:44 Halcy0n Exp $ */




reply via email to

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