ctdb-scripts: Don't bother checking PID file when starting ctdbd
[vlendec/samba-autobuild/.git] / ctdb / tcp / tcp_io.c
index dff5ca670ed340ff2d064c306d1765e633bc7110..5bb4b5bd1a7bdd54425f599a824f62345d8bc3a6 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/>.
 */
 
-#include "includes.h"
-#include "lib/events/events.h"
-#include "lib/util/dlinklist.h"
-#include "lib/tdb/include/tdb.h"
+#include "replace.h"
 #include "system/network.h"
 #include "system/filesys.h"
-#include "../include/ctdb_private.h"
+
+#include "lib/util/dlinklist.h"
+#include "lib/util/debug.h"
+
+#include "ctdb_private.h"
+
+#include "common/common.h"
+#include "common/logging.h"
+
 #include "ctdb_tcp.h"
 
 
@@ -42,31 +46,31 @@ void ctdb_tcp_read_cb(uint8_t *data, size_t cnt, void *args)
        }
 
        if (cnt < sizeof(*hdr)) {
-               DEBUG(0,(__location__ " Bad packet length %u\n", (unsigned)cnt));
+               DEBUG(DEBUG_ALERT,(__location__ " Bad packet length %u\n", (unsigned)cnt));
                goto failed;
        }
 
        if (cnt & (CTDB_TCP_ALIGNMENT-1)) {
-               DEBUG(0,(__location__ " Length 0x%x not multiple of alignment\n", 
+               DEBUG(DEBUG_ALERT,(__location__ " Length 0x%x not multiple of alignment\n", 
                         (unsigned)cnt));
                goto failed;
        }
 
 
        if (cnt != hdr->length) {
-               DEBUG(0,(__location__ " Bad header length %u expected %u\n", 
+               DEBUG(DEBUG_ALERT,(__location__ " Bad header length %u expected %u\n", 
                         (unsigned)hdr->length, (unsigned)cnt));
                goto failed;
        }
 
        if (hdr->ctdb_magic != CTDB_MAGIC) {
-               DEBUG(0,(__location__ " Non CTDB packet 0x%x rejected\n", 
+               DEBUG(DEBUG_ALERT,(__location__ " Non CTDB packet 0x%x rejected\n", 
                         hdr->ctdb_magic));
                goto failed;
        }
 
-       if (hdr->ctdb_version != CTDB_VERSION) {
-               DEBUG(0, (__location__ " Bad CTDB version 0x%x rejected\n", 
+       if (hdr->ctdb_version != CTDB_PROTOCOL) {
+               DEBUG(DEBUG_ALERT, (__location__ " Bad CTDB version 0x%x rejected\n", 
                          hdr->ctdb_version));
                goto failed;
        }
@@ -86,5 +90,5 @@ int ctdb_tcp_queue_pkt(struct ctdb_node *node, uint8_t *data, uint32_t length)
 {
        struct ctdb_tcp_node *tnode = talloc_get_type(node->private_data,
                                                      struct ctdb_tcp_node);
-       return ctdb_queue_send(tnode->queue, data, length);
+       return ctdb_queue_send(tnode->out_queue, data, length);
 }