gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r5346 - GNUnet/src/applications/sqstore_mysql


From: gnunet
Subject: [GNUnet-SVN] r5346 - GNUnet/src/applications/sqstore_mysql
Date: Mon, 23 Jul 2007 01:02:33 -0600 (MDT)

Author: grothoff
Date: 2007-07-23 01:02:30 -0600 (Mon, 23 Jul 2007)
New Revision: 5346

Modified:
   GNUnet/src/applications/sqstore_mysql/mysql.c
Log:
loco

Modified: GNUnet/src/applications/sqstore_mysql/mysql.c
===================================================================
--- GNUnet/src/applications/sqstore_mysql/mysql.c       2007-07-23 00:25:29 UTC 
(rev 5345)
+++ GNUnet/src/applications/sqstore_mysql/mysql.c       2007-07-23 07:02:30 UTC 
(rev 5346)
@@ -543,6 +543,9 @@
  * Given a full (SELECT *) result set from gn071 table,
  * assemble it into a Datastore_Value representation.
  *
+ * Call *without* holding the lock, but while within
+ * mysql_thread_start/end.
+ *
  * @param result location where mysql_stmt_fetch stored the results
  * @return NULL on error
  */
@@ -607,6 +610,12 @@
   rbind[0].buffer_length = contentSize;
   rbind[0].length = &length;
   rbind[0].buffer = &datum[1];
+  MUTEX_LOCK(lock);
+  if (OK != CHECK_DBH)
+    {
+      MUTEX_UNLOCK (lock);
+      return SYSERR;
+    }
   GE_ASSERT (ectx, mysql_stmt_param_count (dbh->select_value) == 1);
   if (mysql_stmt_bind_param (dbh->select_value, qbind))
     {
@@ -616,6 +625,8 @@
               "mysql_stmt_bind_param",
               __FILE__, __LINE__, mysql_stmt_error (dbh->select_value));
       iclose ();
+      MUTEX_UNLOCK (lock);
+      FREE(datum);
       return NULL;
     }
   if (mysql_stmt_execute (dbh->select_value))
@@ -626,6 +637,7 @@
               "mysql_stmt_execute",
               __FILE__, __LINE__, mysql_stmt_error (dbh->select_value));
       iclose ();
+      FREE(datum);
       return NULL;
     }
   GE_ASSERT (ectx, mysql_stmt_field_count (dbh->select_value) == 1);
@@ -637,6 +649,8 @@
               "mysql_stmt_bind_result",
               __FILE__, __LINE__, mysql_stmt_error (dbh->select_value));
       iclose ();
+      MUTEX_UNLOCK (lock);
+      FREE(datum);
       return NULL;
     }
   if ((0 != mysql_stmt_fetch (dbh->select_value)) ||
@@ -650,9 +664,12 @@
               __FILE__, __LINE__, mysql_stmt_error (dbh->select_value));
       delete_entry_by_vkey (vkey);
       content_size -= ntohl (datum->size);
+      MUTEX_UNLOCK (lock);
+      FREE(datum);
       return NULL;
     }
   mysql_stmt_reset (dbh->select_value);
+  MUTEX_UNLOCK (lock);
   return datum;
 }
 
@@ -1204,8 +1221,8 @@
           return count;
         }
       mysql_stmt_reset (stmt);
+      MUTEX_UNLOCK (lock);
       datum = assembleDatum (rbind);
-      MUTEX_UNLOCK (lock);
       if (datum == NULL)
         continue;
       count++;





reply via email to

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