gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r9655 - GNUnet/src/applications/dhtlog_mysql


From: gnunet
Subject: [GNUnet-SVN] r9655 - GNUnet/src/applications/dhtlog_mysql
Date: Tue, 1 Dec 2009 14:19:27 +0100

Author: grothoff
Date: 2009-12-01 14:19:27 +0100 (Tue, 01 Dec 2009)
New Revision: 9655

Modified:
   GNUnet/src/applications/dhtlog_mysql/check.conf
   GNUnet/src/applications/dhtlog_mysql/dhtlog_mysql.c
   GNUnet/src/applications/dhtlog_mysql/dhtlog_test.c
Log:
use gnunetcheck db and ~/.my.cnf

Modified: GNUnet/src/applications/dhtlog_mysql/check.conf
===================================================================
--- GNUnet/src/applications/dhtlog_mysql/check.conf     2009-12-01 13:05:56 UTC 
(rev 9654)
+++ GNUnet/src/applications/dhtlog_mysql/check.conf     2009-12-01 13:19:27 UTC 
(rev 9655)
@@ -16,6 +16,12 @@
 dstore = dstore_sqlite
 topology = topology_default
 
+
+[MYSQL]
+DATABASE = "gnunetcheck"
+CONFIG = ~/.my.cnf
+
+
 [NETWORK]
 PORT = 12083
 HELLOEXCHANGE = YES

Modified: GNUnet/src/applications/dhtlog_mysql/dhtlog_mysql.c
===================================================================
--- GNUnet/src/applications/dhtlog_mysql/dhtlog_mysql.c 2009-12-01 13:05:56 UTC 
(rev 9654)
+++ GNUnet/src/applications/dhtlog_mysql/dhtlog_mysql.c 2009-12-01 13:19:27 UTC 
(rev 9655)
@@ -35,12 +35,8 @@
 
 static unsigned long max_varchar_len;
 
-static char *blank;
-
 static GNUNET_CoreAPIForPlugins *coreAPI;
 
-static struct GNUNET_GC_Configuration *dhtlog_cfg;
-
 static unsigned long long current_trial = 0;    /* I like to assign 0, just to 
remember */
 
 /**
@@ -179,7 +175,7 @@
   int ret;
   if (db != NULL)
     return GNUNET_OK;
-  db = GNUNET_MYSQL_database_open (coreAPI->ectx, dhtlog_cfg);
+  db = GNUNET_MYSQL_database_open (coreAPI->ectx, coreAPI->cfg);
   if (db == NULL)
     return GNUNET_SYSERR;
 
@@ -704,87 +700,21 @@
 provide_module_dhtlog_mysql (GNUNET_CoreAPIForPlugins * capi)
 {
   static GNUNET_dhtlog_ServiceAPI api;
-  char *mysql_server;
-  char *mysql_user;
-  char *mysql_db;
-  char *mysql_password;
-  unsigned long long mysql_port;
 
-  dhtlog_cfg = GNUNET_GC_create ();
   coreAPI = capi;
   max_varchar_len = 255;
-  blank = "";
 #if DEBUG_DHTLOG
   GNUNET_GE_LOG (capi->ectx,
                  GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER |
                  GNUNET_GE_BULK, "MySQL DHT Logger: initializing database\n");
   fprintf (stderr, "MySQL DHT Logger: initializing database\n");
 #endif
-
-  GNUNET_GC_get_configuration_value_string (capi->cfg,
-                                            "MULTIPLE_SERVER_TESTING",
-                                            "MYSQL_SERVER", "localhost",
-                                            &mysql_server);
-
-  GNUNET_GC_get_configuration_value_string (capi->cfg,
-                                            "MULTIPLE_SERVER_TESTING",
-                                            "MYSQL_DB", "dhttests",
-                                            &mysql_db);
-
-  GNUNET_GC_get_configuration_value_string (capi->cfg,
-                                            "MULTIPLE_SERVER_TESTING",
-                                            "MYSQL_USER", "dht", &mysql_user);
-
-  GNUNET_GC_get_configuration_value_string (capi->cfg,
-                                            "MULTIPLE_SERVER_TESTING",
-                                            "MYSQL_PASSWORD", "dht**",
-                                            &mysql_password);
-
-  GNUNET_GC_get_configuration_value_number (capi->cfg,
-                                            "MULTIPLE_SERVER_TESTING",
-                                            "MYSQL_PORT", 1, -1, 3306,
-                                            &mysql_port);
-
-  GNUNET_GC_set_configuration_value_string (dhtlog_cfg,
-                                            NULL,
-                                            "MYSQL", "DATABASE", mysql_db);
-
-  GNUNET_GC_set_configuration_value_string (dhtlog_cfg,
-                                            NULL,
-                                            "MYSQL", "HOST", mysql_server);
-
-  GNUNET_GC_set_configuration_value_string (dhtlog_cfg,
-                                            NULL,
-                                            "MYSQL", "USER", mysql_user);
-
-  GNUNET_GC_set_configuration_value_string (dhtlog_cfg,
-                                            NULL,
-                                            "MYSQL", "PASSWORD",
-                                            mysql_password);
-
-  GNUNET_GC_set_configuration_value_number (dhtlog_cfg,
-                                            NULL,
-                                            "MYSQL", "PORT", mysql_port);
-
-#if DEBUG_DHTLOG
-  GNUNET_GE_LOG (coreAPI->ectx,
-                 GNUNET_GE_WARNING | GNUNET_GE_ADMIN | GNUNET_GE_USER |
-                 GNUNET_GE_BULK,
-                 _
-                 ("pertinent mysql information: host %s, user %s, port %llu, 
pass %s, DB %s\n"),
-                 mysql_server, mysql_user, mysql_port, mysql_password,
-                 mysql_db);
-#endif
   if (iopen () != GNUNET_OK)
     {
       GNUNET_GE_LOG (coreAPI->ectx,
                      GNUNET_GE_ERROR | GNUNET_GE_IMMEDIATE | GNUNET_GE_USER,
                      _
                      ("Failed to initialize MySQL database connection for 
dhtlog.\n"));
-      GNUNET_free (mysql_user);
-      GNUNET_free (mysql_password);
-      GNUNET_free (mysql_db);
-      GNUNET_free (mysql_server);
       return NULL;
     }
 
@@ -799,10 +729,6 @@
   GNUNET_GE_LOG (coreAPI->ectx,
                  GNUNET_GE_WARNING | GNUNET_GE_ADMIN | GNUNET_GE_USER |
                  GNUNET_GE_BULK, _("current trial is %llu\n"), current_trial);
-  GNUNET_free (mysql_user);
-  GNUNET_free (mysql_password);
-  GNUNET_free (mysql_db);
-  GNUNET_free (mysql_server);
   return &api;
 }
 

Modified: GNUnet/src/applications/dhtlog_mysql/dhtlog_test.c
===================================================================
--- GNUnet/src/applications/dhtlog_mysql/dhtlog_test.c  2009-12-01 13:05:56 UTC 
(rev 9654)
+++ GNUnet/src/applications/dhtlog_mysql/dhtlog_test.c  2009-12-01 13:19:27 UTC 
(rev 9655)
@@ -136,7 +136,7 @@
       return -1;
     }
   cron = GNUNET_cron_create (NULL);
-  GNUNET_CORE_init (NULL, cfg, cron, NULL);
+  GNUNET_GE_ASSERT (NULL, GNUNET_OK == GNUNET_CORE_init (NULL, cfg, cron, 
NULL));
 
   api = GNUNET_CORE_request_service ("dhtlog_mysql");
   if (api != NULL)





reply via email to

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