summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-04-08 05:46:00 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:11:28 -0500
commit866c62f26d110439c8d5cb584f60d24564d6a79c (patch)
tree60d0cdabbae0942ae7444c1c4dd6ab11d8bd4b02 /source4
parentf83e6ded9d31f819dba5e59e15c703d292716206 (diff)
downloadsamba-866c62f26d110439c8d5cb584f60d24564d6a79c.tar.gz
samba-866c62f26d110439c8d5cb584f60d24564d6a79c.tar.bz2
samba-866c62f26d110439c8d5cb584f60d24564d6a79c.zip
r6246: stop waiting when we get a reply
(This used to be commit 8b9a5d8336da43619fc1ea8f081d5ade98f0599b)
Diffstat (limited to 'source4')
-rw-r--r--source4/torture/nbt/dgram.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/source4/torture/nbt/dgram.c b/source4/torture/nbt/dgram.c
index b87e7e0b0f..f7d838e32a 100644
--- a/source4/torture/nbt/dgram.c
+++ b/source4/torture/nbt/dgram.c
@@ -38,6 +38,7 @@ static void netlogon_handler(struct dgram_mailslot_handler *dgmslot,
{
NTSTATUS status;
struct nbt_netlogon_packet netlogon;
+ int *replies = dgmslot->private;
printf("netlogon reply from %s:%d\n", src_address, src_port);
@@ -49,6 +50,8 @@ static void netlogon_handler(struct dgram_mailslot_handler *dgmslot,
}
NDR_PRINT_DEBUG(nbt_netlogon_packet, &netlogon);
+
+ (*replies)++;
}
@@ -62,8 +65,8 @@ static BOOL nbt_test_netlogon(TALLOC_CTX *mem_ctx,
struct nbt_netlogon_packet logon;
struct nbt_name myname;
NTSTATUS status;
- int timelimit = lp_parm_int(-1, "torture", "timelimit", 10);
struct timeval tv = timeval_current();
+ int replies = 0;
/* try receiving replies on port 138 first, which will only
work if we are root and smbd/nmbd are not running - fall
@@ -76,7 +79,7 @@ static BOOL nbt_test_netlogon(TALLOC_CTX *mem_ctx,
/* setup a temporary mailslot listener for replies */
dgmslot = dgram_mailslot_temp(dgmsock, "\\MAILSLOT\\NET\\GETDC",
- netlogon_handler, NULL);
+ netlogon_handler, &replies);
ZERO_STRUCT(logon);
@@ -99,7 +102,7 @@ static BOOL nbt_test_netlogon(TALLOC_CTX *mem_ctx,
}
- while (timeval_elapsed(&tv) < timelimit) {
+ while (timeval_elapsed(&tv) < 5 && replies == 0) {
event_loop_once(dgmsock->event_ctx);
}