s3-messages: only include messages.h where needed.
[samba.git] / source3 / lib / ctdbd_conn.c
index dee477f3c525f2924d88e6a2e37fc2e5f2b0018b..cc2f99782af22625895e6a0c5711abd06c231594 100644 (file)
@@ -25,6 +25,8 @@
 #include "librpc/gen_ndr/messaging.h"
 #include "librpc/gen_ndr/ndr_messaging.h"
 #include "ctdbd_conn.h"
+#include "packet.h"
+#include "messages.h"
 
 /* paths to these include files come from --with-ctdb= in configure */
 #include "ctdb.h"
@@ -155,7 +157,7 @@ static bool ctdbd_working(struct ctdbd_connection *conn, uint32_t vnn)
        ret = true;
 fail:
        TALLOC_FREE(outdata.dptr);
-       return ret;;
+       return ret;
 }
 
 uint32 ctdbd_vnn(const struct ctdbd_connection *conn)
@@ -331,13 +333,12 @@ static struct messaging_rec *ctdb_pull_messaging_rec(TALLOC_CTX *mem_ctx,
 
 static NTSTATUS ctdb_packet_fd_read_sync(struct packet_context *ctx)
 {
-       struct timeval timeout;
-       struct timeval *ptimeout;
+       int timeout = lp_ctdb_timeout();
 
-       timeout = timeval_set(lp_ctdb_timeout(), 0);
-       ptimeout = (timeout.tv_sec != 0) ? &timeout : NULL;
-
-       return packet_fd_read_sync(ctx, ptimeout);
+       if (timeout == 0) {
+               timeout = -1;
+       }
+       return packet_fd_read_sync(ctx, timeout);
 }
 
 /*
@@ -515,6 +516,7 @@ static NTSTATUS ctdbd_init_connection(TALLOC_CTX *mem_ctx,
 
        if (!ctdbd_working(conn, conn->our_vnn)) {
                DEBUG(2, ("Node is not working, can not connect\n"));
+               status = NT_STATUS_INTERNAL_DB_ERROR;
                goto fail;
        }