From d4ceaff6a56215cd9ca4b0b115b14bae91e03b34 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 3 Aug 2004 08:04:51 +0000 Subject: r1636: improved the negnowait test so it is standalone (taking advantage of the async APIs) (This used to be commit 19c22760c699aa2b000f023ff6083055a27a83cb) --- source4/torture/torture.c | 40 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 36 insertions(+), 4 deletions(-) diff --git a/source4/torture/torture.c b/source4/torture/torture.c index 761eb7ef65..90f6226200 100644 --- a/source4/torture/torture.c +++ b/source4/torture/torture.c @@ -1890,7 +1890,7 @@ static BOOL run_maxfidtest(struct cli_state *cli, int dummy) static BOOL run_negprot_nowait(int dummy) { int i; - struct cli_state *cli; + struct cli_state *cli, *cli2; BOOL correct = True; printf("starting negprot nowait test\n"); @@ -1900,16 +1900,48 @@ static BOOL run_negprot_nowait(int dummy) return False; } - printf("Establishing protocol negotiations - connect with another client\n"); + printf("Filling send buffer\n"); + + for (i=0;i<10000;i++) { + struct cli_request *req; + time_t t1 = time(NULL); + req = smb_negprot_send(cli->transport, PROTOCOL_NT1); + while (req->state == CLI_REQUEST_SEND && time(NULL) < t1+5) { + cli_transport_process(cli->transport); + } + if (req->state == CLI_REQUEST_ERROR) { + printf("Failed to fill pipe - %s\n", nt_errstr(req->status)); + torture_close_connection(cli); + return correct; + } + if (req->state == CLI_REQUEST_SEND) { + break; + } + } + + if (i == 10000) { + printf("send buffer failed to fill\n"); + if (!torture_close_connection(cli)) { + correct = False; + } + return correct; + } + + printf("send buffer filled after %d requests\n", i); - for (i=0;i<50000;i++) { - smb_negprot_send(cli->transport, PROTOCOL_NT1); + printf("Opening secondary connection\n"); + if (!torture_open_connection(&cli2)) { + return False; } if (!torture_close_connection(cli)) { correct = False; } + if (!torture_close_connection(cli2)) { + correct = False; + } + printf("finished negprot nowait test\n"); return correct; -- cgit