Add utility function cli_in_chain()
authorVolker Lendecke <vl@sernet.de>
Tue, 9 Sep 2008 12:37:17 +0000 (14:37 +0200)
committerVolker Lendecke <vl@samba.org>
Tue, 9 Sep 2008 15:37:34 +0000 (17:37 +0200)
This gives a hint whether a function is called from within the middle of a
chain. In particular the trans calls don't really like this.
(This used to be commit 4252b32db5ef7483f2c5c52312b6e6dc68d1d687)

source3/include/async_smb.h
source3/libsmb/async_smb.c

index e9e10023e34790507d6cf8a7e3de2c9009638637..4e2061813f533a4f69cc56d805d696d647695f5c 100644 (file)
@@ -124,6 +124,7 @@ struct async_req *cli_request_send(TALLOC_CTX *mem_ctx,
 bool cli_chain_cork(struct cli_state *cli, struct event_context *ev,
                    size_t size_hint);
 void cli_chain_uncork(struct cli_state *cli);
+bool cli_in_chain(struct cli_state *cli);
 
 NTSTATUS cli_pull_reply(struct async_req *req,
                        uint8_t *pwct, uint16_t **pvwv,
index 435c8c1cb9d7bc7d6bb4fef7ec0a4306158174a4..c875acbe48fd2da3fedd13db7bf09cc087524c98 100644 (file)
@@ -136,6 +136,21 @@ static int cli_request_destructor(struct cli_request *req)
        return 0;
 }
 
+/**
+ * Are there already requests waiting in the chain_accumulator?
+ * @param[in] cli      The cli_state we want to check
+ * @retval reply :-)
+ */
+
+bool cli_in_chain(struct cli_state *cli)
+{
+       if (cli->chain_accumulator == NULL) {
+               return false;
+       }
+
+       return (cli->chain_accumulator->num_async != 0);
+}
+
 /**
  * Is the SMB command able to hold an AND_X successor
  * @param[in] cmd      The SMB command in question