summaryrefslogtreecommitdiff
path: root/source3/lib/packet.c
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2009-11-03 05:41:02 +0100
committerVolker Lendecke <vl@samba.org>2009-11-05 12:05:36 +0100
commitd415d4d32f2e8e61de21abfdfce02e1b1ea1e1d3 (patch)
tree03469f109c8e19e15318e5fa4da6d7526b6a575f /source3/lib/packet.c
parent49397a8b3e30b23a4723125986f306fff502a144 (diff)
downloadsamba-d415d4d32f2e8e61de21abfdfce02e1b1ea1e1d3.tar.gz
samba-d415d4d32f2e8e61de21abfdfce02e1b1ea1e1d3.tar.bz2
samba-d415d4d32f2e8e61de21abfdfce02e1b1ea1e1d3.zip
s3: Add parameter "ctdb timeout"
When something in the cluster blocks, it can happen that we wait indefinitely long for ctdb, just adding to the blocking condition. In theory, nothing should block, but as someone said "In practice the difference between theory and practice is larger than in theory". This adds a timeout parameter in seconds, after which we stop waiting for ctdb and panic.
Diffstat (limited to 'source3/lib/packet.c')
-rw-r--r--source3/lib/packet.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/source3/lib/packet.c b/source3/lib/packet.c
index ef28bf9f62..c131b973bc 100644
--- a/source3/lib/packet.c
+++ b/source3/lib/packet.c
@@ -101,7 +101,8 @@ NTSTATUS packet_fd_read(struct packet_context *ctx)
return NT_STATUS_OK;
}
-NTSTATUS packet_fd_read_sync(struct packet_context *ctx)
+NTSTATUS packet_fd_read_sync(struct packet_context *ctx,
+ struct timeval *timeout)
{
int res;
fd_set r_fds;
@@ -109,7 +110,12 @@ NTSTATUS packet_fd_read_sync(struct packet_context *ctx)
FD_ZERO(&r_fds);
FD_SET(ctx->fd, &r_fds);
- res = sys_select(ctx->fd+1, &r_fds, NULL, NULL, NULL);
+ res = sys_select(ctx->fd+1, &r_fds, NULL, NULL, timeout);
+
+ if (res == 0) {
+ DEBUG(10, ("select timed out\n"));
+ return NT_STATUS_IO_TIMEOUT;
+ }
if (res == -1) {
DEBUG(10, ("select returned %s\n", strerror(errno)));