svn commit: samba r6246 - in branches/SAMBA_4_0/source/torture/nbt: .

tridge at samba.org tridge at samba.org
Fri Apr 8 05:46:00 GMT 2005


Author: tridge
Date: 2005-04-08 05:46:00 +0000 (Fri, 08 Apr 2005)
New Revision: 6246

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=6246

Log:
stop waiting when we get a reply

Modified:
   branches/SAMBA_4_0/source/torture/nbt/dgram.c


Changeset:
Modified: branches/SAMBA_4_0/source/torture/nbt/dgram.c
===================================================================
--- branches/SAMBA_4_0/source/torture/nbt/dgram.c	2005-04-08 05:34:13 UTC (rev 6245)
+++ branches/SAMBA_4_0/source/torture/nbt/dgram.c	2005-04-08 05:46:00 UTC (rev 6246)
@@ -38,6 +38,7 @@
 {
 	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 @@
 	}
 
 	NDR_PRINT_DEBUG(nbt_netlogon_packet, &netlogon);
+
+	(*replies)++;
 }
 
 
@@ -62,8 +65,8 @@
 	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 @@
 
 	/* 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 @@
 	}
 
 
-	while (timeval_elapsed(&tv) < timelimit) {
+	while (timeval_elapsed(&tv) < 5 && replies == 0) {
 		event_loop_once(dgmsock->event_ctx);
 	}
 



More information about the samba-cvs mailing list