TDB : Fix for a deadlock with transaction lock and lockall/lockallmark
[sahlberg/ctdb.git] / common / ctdb_message.c
index 87010e464cbb056f2b291f1c8fcbef0083fdd51f..03a4b55389c01ae6f9068e9673f233c6706593c6 100644 (file)
@@ -5,7 +5,7 @@
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
+   the Free Software Foundation; either version 3 of the License, or
    (at your option) any later version.
    
    This program is distributed in the hope that it will be useful,
    GNU General Public License for more details.
    
    You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+   along with this program; if not, see <http://www.gnu.org/licenses/>.
 */
 /*
   see http://wiki.samba.org/index.php/Samba_%26_Clustering for
   protocol design and packet details
 */
 #include "includes.h"
-#include "lib/events/events.h"
+#include "lib/tevent/tevent.h"
 #include "lib/tdb/include/tdb.h"
 #include "system/network.h"
 #include "system/filesys.h"
@@ -53,8 +52,8 @@ void ctdb_request_message(struct ctdb_context *ctdb, struct ctdb_req_header *hdr
        struct ctdb_req_message *c = (struct ctdb_req_message *)hdr;
        TDB_DATA data;
 
-       data.dptr = &c->data[0];
        data.dsize = c->datalen;
+       data.dptr = talloc_memdup(c, &c->data[0], c->datalen);
 
        ctdb_dispatch_message(ctdb, c->srvid, data);
 }
@@ -75,7 +74,7 @@ static int message_handler_destructor(struct ctdb_message_list *m)
 int ctdb_register_message_handler(struct ctdb_context *ctdb, 
                                  TALLOC_CTX *mem_ctx,
                                  uint64_t srvid,
-                                 ctdb_message_fn_t handler,
+                                 ctdb_msg_fn_t handler,
                                  void *private_data)
 {
        struct ctdb_message_list *m;