gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r8605 - GNUnet/src/applications/dhtlog_mysql
Date: Fri, 26 Jun 2009 14:16:22 -0600

Author: nevans
Date: 2009-06-26 14:16:22 -0600 (Fri, 26 Jun 2009)
New Revision: 8605

Modified:
   GNUnet/src/applications/dhtlog_mysql/dhtlog_mysql.c
   GNUnet/src/applications/dhtlog_mysql/dhtlog_test.c
Log:
changes

Modified: GNUnet/src/applications/dhtlog_mysql/dhtlog_mysql.c
===================================================================
--- GNUnet/src/applications/dhtlog_mysql/dhtlog_mysql.c 2009-06-26 20:14:08 UTC 
(rev 8604)
+++ GNUnet/src/applications/dhtlog_mysql/dhtlog_mysql.c 2009-06-26 20:16:22 UTC 
(rev 8605)
@@ -155,7 +155,7 @@
   if (MRUNS ("CREATE TABLE IF NOT EXISTS `trials` ("
              "`trialuid` int(10) unsigned NOT NULL auto_increment,"
              "`numnodes` int(10) unsigned NOT NULL,"
-             "`topology` varchar(55) NOT NULL,"
+             "`topology` int(10) NOT NULL,"
              "`starttime` datetime NOT NULL,"
              "`endtime` datetime NOT NULL,"
              "PRIMARY KEY  (`trialuid`),"
@@ -237,23 +237,17 @@
  * Inserts the specified trial into the dhttests.trials table
  */
 int
-add_trial (unsigned long long *trialuid, int num_nodes, char *topology)
+add_trial (unsigned long long *trialuid, int num_nodes, int topology)
 {
-
   int ret;
-  unsigned long long t_len;
-  t_len = strlen (topology);
-
   if (GNUNET_OK !=
       (ret = GNUNET_MYSQL_prepared_statement_run (insert_trial,
                                                   trialuid,
                                                   MYSQL_TYPE_LONG,
                                                   &num_nodes,
                                                   GNUNET_YES,
-                                                  MYSQL_TYPE_VAR_STRING,
-                                                  topology,
-                                                  max_varchar_len,
-                                                  &t_len, -1)))
+                                                  MYSQL_TYPE_LONG,
+                                                  &topology, GNUNET_YES, -1)))
     {
       if (ret == GNUNET_SYSERR)
         {
@@ -274,7 +268,7 @@
  * stores return value of dhttests.dhtkeys.dhtkeyuid into dhtkeyuid
  */
 int
-add_dhtkey (unsigned long long *dhtkeyuid, GNUNET_HashCode * dhtkey)
+add_dhtkey (unsigned long long *dhtkeyuid, const GNUNET_HashCode * dhtkey)
 {
 
   int ret;
@@ -305,7 +299,7 @@
 
 
 static int
-get_dhtkey_uid (unsigned long long *dhtkeyuid, GNUNET_HashCode * key)
+get_dhtkey_uid (unsigned long long *dhtkeyuid, const GNUNET_HashCode * key)
 {
   MYSQL_BIND rbind[1];
   GNUNET_EncName encKey;
@@ -337,7 +331,7 @@
 }
 
 static int
-get_node_uid (unsigned long long *nodeuid, GNUNET_HashCode * peerHash)
+get_node_uid (unsigned long long *nodeuid, const GNUNET_HashCode * peerHash)
 {
   MYSQL_BIND rbind[1];
   GNUNET_EncName encPeer;
@@ -352,10 +346,6 @@
   GNUNET_hash_to_enc (peerHash, &encPeer);
   p_len = strlen ((char *) &encPeer);
 
-#if DEBUG_DHTLOG
-  fprintf (stderr, "Searching for peer %s\n", (char *) &encPeer);
-#endif
-
   if (1 != (ret = GNUNET_MYSQL_prepared_statement_run_select (get_nodeuid,
                                                               1,
                                                               rbind,
@@ -368,8 +358,12 @@
                                                               &encPeer,
                                                               max_varchar_len,
                                                               &p_len, -1)))
-    return GNUNET_SYSERR;
-
+    {
+#if DEBUG_DHTLOG
+      fprintf (stderr, "FAILED\n");
+#endif
+      return GNUNET_SYSERR;
+    }
   return GNUNET_OK;
 }
 
@@ -445,7 +439,7 @@
 int
 add_query (unsigned long long *sqlqueryuid, unsigned long long queryid,
            unsigned int type, unsigned int hops, int succeeded,
-           GNUNET_PeerIdentity * node, GNUNET_HashCode * key)
+           const GNUNET_PeerIdentity * node, const GNUNET_HashCode * key)
 {
   int ret;
   unsigned long long peer_uid, key_uid;
@@ -512,10 +506,14 @@
 int
 add_route (unsigned long long *sqlqueryuid, unsigned long long queryid,
            unsigned int type, unsigned int hops,
-           int succeeded, GNUNET_PeerIdentity * node, GNUNET_HashCode * key,
-           GNUNET_PeerIdentity * from_node, GNUNET_PeerIdentity * to_node)
+           int succeeded, const GNUNET_PeerIdentity * node,
+           const GNUNET_HashCode * key, const GNUNET_PeerIdentity * from_node,
+           const GNUNET_PeerIdentity * to_node)
 {
-  unsigned long long peer_uid, key_uid, from_uid, to_uid = 0;
+  unsigned long long peer_uid = 0;
+  unsigned long long key_uid = 0;
+  unsigned long long from_uid = 0;
+  unsigned long long to_uid = 0;
   int ret;
 
   if (from_node != NULL)
@@ -548,9 +546,6 @@
   else
     return GNUNET_SYSERR;
 
-  fprintf (stderr, "fromnode %llu, tonode %llu, peeruid %llu, keyuid %llu\n",
-           from_uid, to_uid, peer_uid, key_uid);
-
   if (GNUNET_OK !=
       (ret = GNUNET_MYSQL_prepared_statement_run (insert_route,
                                                   sqlqueryuid,
@@ -611,8 +606,8 @@
   blank = "";
 #if DEBUG_DHTLOG
   GNUNET_GE_LOG (capi->ectx,
-                 GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
-                 "MySQL DHT Logger: initializing database\n");
+                 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
 
@@ -662,10 +657,13 @@
                                             "MYSQL", "PORT", mysql_port);
 
 #if DEBUG_DHTLOG
-  fprintf (stderr,
-           _
-           ("pertinent mysql information: host %s, user %s, port %llu, pass 
%s, DB %s\n"),
-           mysql_server, mysql_user, mysql_port, mysql_password, mysql_db);
+  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)
     {

Modified: GNUnet/src/applications/dhtlog_mysql/dhtlog_test.c
===================================================================
--- GNUnet/src/applications/dhtlog_mysql/dhtlog_test.c  2009-06-26 20:14:08 UTC 
(rev 8604)
+++ GNUnet/src/applications/dhtlog_mysql/dhtlog_test.c  2009-06-26 20:16:22 UTC 
(rev 8605)
@@ -63,7 +63,7 @@
   memset (&k1, 0, sizeof (GNUNET_HashCode));
   memset (&k2, 1, sizeof (GNUNET_HashCode));
 
-  ret = api->insert_trial (&trialuid, i, "trialtest");
+  ret = api->insert_trial (&trialuid, i, 5);
   fprintf (stderr, "Trial uid is %llu\n", trialuid);
 
   if (ret != GNUNET_OK)





reply via email to

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