From ba8319e02c4e4291b749b4f16d7bbbff2c44f62c Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Wed, 28 Jan 2015 15:13:26 +0100 Subject: [PATCH] debug credits client... reproduce https://bugzilla.samba.org/show_bug.cgi?id=9702 --- libcli/smb/smbXcli_base.c | 22 +++++++++++++++++++++- source3/client/client.c | 2 +- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/libcli/smb/smbXcli_base.c b/libcli/smb/smbXcli_base.c index 8aa6020..7453cc0 100644 --- a/libcli/smb/smbXcli_base.c +++ b/libcli/smb/smbXcli_base.c @@ -2555,6 +2555,7 @@ void smb2cli_conn_set_max_credits(struct smbXcli_conn *conn, uint16_t max_credits) { conn->smb2.max_credits = max_credits; + conn->smb2.max_credits = 128; } static void smb2cli_req_cancel_done(struct tevent_req *subreq); @@ -2934,11 +2935,25 @@ NTSTATUS smb2cli_req_compound_submit(struct tevent_req **reqs, credits = state->conn->smb2.max_credits - state->conn->smb2.cur_credits; } - if (state->conn->smb2.max_credits >= state->conn->smb2.cur_credits) { + if (state->conn->smb2.max_credits > state->conn->smb2.cur_credits) { credits += 1; } + if (credits == 0) { + state->conn->smb2.max_credits = 0; + } + mid = state->conn->smb2.mid; + if (state->conn->smb2.server.capabilities & SMB2_CAP_LARGE_MTU) { + if (avail > charge) { + charge++; + } + } + DEBUG(0,("opcode[%u] mid[%llu] requests credits[%u] charge[%u] max[%u] cur[%u] avail[%llu]\n", + opcode, (unsigned long long)mid, credits, charge, + state->conn->smb2.max_credits, + state->conn->smb2.cur_credits, + (unsigned long long)avail)); state->conn->smb2.mid += charge; state->conn->smb2.cur_credits -= charge; @@ -3375,6 +3390,11 @@ static NTSTATUS smb2cli_conn_dispatch_incoming(struct smbXcli_conn *conn, const DATA_BLOB *signing_key = NULL; bool was_encrypted = false; + DEBUG(0,("opcode[%u] mid[%llu] RESPONSE credits[%u] max[%u] cur[%u] \n", + opcode, (unsigned long long)mid, credits, + conn->smb2.max_credits, + conn->smb2.cur_credits)); + new_credits = conn->smb2.cur_credits; new_credits += credits; if (new_credits > UINT16_MAX) { diff --git a/source3/client/client.c b/source3/client/client.c index 5d70897..97cc6ca 100644 --- a/source3/client/client.c +++ b/source3/client/client.c @@ -5138,7 +5138,7 @@ static void readline_callback(void) clock_gettime_mono(&now); t = now.tv_sec; - if (t - last_t < 5) + if (t - last_t < 1) return; last_t = t; -- 1.9.1