diff options
author | Stefan Metzmacher <metze@samba.org> | 2013-08-13 14:05:05 +0200 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2013-08-15 09:07:06 +0200 |
commit | 111f529a2a5832b822445bb4f63b142d8ccb2cb7 (patch) | |
tree | 1b376acd4044c553168f69ac6d12bd82de8df295 /libcli/smb | |
parent | 44b53937d59842a63e2cbfa92219f4f519530b0a (diff) | |
download | samba-111f529a2a5832b822445bb4f63b142d8ccb2cb7.tar.gz samba-111f529a2a5832b822445bb4f63b142d8ccb2cb7.tar.bz2 samba-111f529a2a5832b822445bb4f63b142d8ccb2cb7.zip |
libcli/smb: add smb1cli_conn_req_possible()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'libcli/smb')
-rw-r--r-- | libcli/smb/smbXcli_base.c | 17 | ||||
-rw-r--r-- | libcli/smb/smbXcli_base.h | 1 |
2 files changed, 18 insertions, 0 deletions
diff --git a/libcli/smb/smbXcli_base.c b/libcli/smb/smbXcli_base.c index 2562442f28..9e8725c43a 100644 --- a/libcli/smb/smbXcli_base.c +++ b/libcli/smb/smbXcli_base.c @@ -595,6 +595,23 @@ uint32_t smb1cli_conn_max_xmit(struct smbXcli_conn *conn) return conn->smb1.max_xmit; } +bool smb1cli_conn_req_possible(struct smbXcli_conn *conn) +{ + size_t pending; + uint16_t possible = conn->smb1.server.max_mux; + + pending = tevent_queue_length(conn->outgoing); + if (pending >= possible) { + return false; + } + pending += talloc_array_length(conn->pending); + if (pending >= possible) { + return false; + } + + return true; +} + uint32_t smb1cli_conn_server_session_key(struct smbXcli_conn *conn) { return conn->smb1.server.session_key; diff --git a/libcli/smb/smbXcli_base.h b/libcli/smb/smbXcli_base.h index 4ce39c0db1..6b3156f42a 100644 --- a/libcli/smb/smbXcli_base.h +++ b/libcli/smb/smbXcli_base.h @@ -69,6 +69,7 @@ bool smbXcli_req_set_pending(struct tevent_req *req); uint32_t smb1cli_conn_capabilities(struct smbXcli_conn *conn); uint32_t smb1cli_conn_max_xmit(struct smbXcli_conn *conn); +bool smb1cli_conn_req_possible(struct smbXcli_conn *conn); uint32_t smb1cli_conn_server_session_key(struct smbXcli_conn *conn); const uint8_t *smb1cli_conn_server_challenge(struct smbXcli_conn *conn); uint16_t smb1cli_conn_server_security_mode(struct smbXcli_conn *conn); |