gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r8851 - GNUnet/src/applications/dhtlog_mysql
Date: Tue, 25 Aug 2009 12:53:40 -0600

Author: nevans
Date: 2009-08-25 12:53:40 -0600 (Tue, 25 Aug 2009)
New Revision: 8851

Modified:
   GNUnet/src/applications/dhtlog_mysql/dhtlog_mysql.c
Log:
log dropped messages, free resources

Modified: GNUnet/src/applications/dhtlog_mysql/dhtlog_mysql.c
===================================================================
--- GNUnet/src/applications/dhtlog_mysql/dhtlog_mysql.c 2009-08-25 18:52:37 UTC 
(rev 8850)
+++ GNUnet/src/applications/dhtlog_mysql/dhtlog_mysql.c 2009-08-25 18:53:40 UTC 
(rev 8851)
@@ -69,7 +69,7 @@
                           "VALUES (?, ?, ?)"
 static struct GNUNET_MysqlStatementHandle *insert_dhtkey;
 
-#define UPDATE_TRIALS_STMT "UPDATE trials set endtime=NOW() where trialuid = ?"
+#define UPDATE_TRIALS_STMT "UPDATE trials set endtime=NOW(), 
totalMessagesDropped = ?, totalBytesDropped = ? where trialuid = ?"
 static struct GNUNET_MysqlStatementHandle *update_trial;
 
 #define UPDATE_CONNECTIONS_STMT "UPDATE trials set totalConnections = ? where 
trialuid = ?"
@@ -155,6 +155,8 @@
              "`malicious_putters` int(10) unsigned NOT NULL,"
              "`malicious_droppers` int(10) unsigned NOT NULL,"
              "`message` text NOT NULL,"
+             "`totalMessagesDropped` int(10) unsigned NOT NULL,"
+             "`totalBytesDropped` int(10) unsigned NOT NULL,"
              "PRIMARY KEY  (`trialuid`),"
              "UNIQUE KEY `trialuid` (`trialuid`)"
              ") ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1"))
@@ -450,7 +452,9 @@
  * Update dhttests.trials table with current server time as end time
  */
 int
-update_trials (unsigned long long trialuid)
+update_trials (unsigned long long trialuid,
+               unsigned long long totalMessagesDropped,
+               unsigned long long totalBytesDropped)
 {
   int ret;
 #if DEBUG_DHTLOG
@@ -464,6 +468,12 @@
       (ret = GNUNET_MYSQL_prepared_statement_run (update_trial,
                                                   NULL,
                                                   MYSQL_TYPE_LONGLONG,
+                                                  &totalMessagesDropped,
+                                                  GNUNET_YES,
+                                                  MYSQL_TYPE_LONGLONG,
+                                                  &totalBytesDropped,
+                                                  GNUNET_YES,
+                                                  MYSQL_TYPE_LONGLONG,
                                                   &trialuid, GNUNET_YES, -1)))
     {
       if (ret == GNUNET_SYSERR)
@@ -757,6 +767,10 @@
                      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;
     }
 
@@ -771,6 +785,10 @@
   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;
 }
 





reply via email to

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