[PATCH] Clean up client timeout definitions [rev. 2]
Steve French
smfrench at gmail.com
Tue Dec 4 11:42:22 MST 2012
You can add my Reviewed-by
On Tue, Dec 4, 2012 at 8:15 AM, <scott.lovenberg at gmail.com> wrote:
> From: Scott Lovenberg <scott.lovenberg at gmail.com>
>
> The definitions for default client timeout values have been moved to client.h. When initializing a client struct we use this value instead of the old hardcoded value. The timeout value remains 20 seconds.
>
> Signed-off-by: Scott Lovenberg <scott.lovenberg at gmail.com>
> ---
> source3/client/client.c | 4 ----
> source3/client/clitar.c | 3 ---
> source3/include/client.h | 5 +++++
> source3/libsmb/clientgen.c | 3 ++-
> 4 files changed, 7 insertions(+), 8 deletions(-)
>
> diff --git a/source3/client/client.c b/source3/client/client.c
> index f8cc27d..179ba06 100644
> --- a/source3/client/client.c
> +++ b/source3/client/client.c
> @@ -65,10 +65,6 @@ static int cmd_help(void);
>
> #define CREATE_ACCESS_READ READ_CONTROL_ACCESS
>
> -/* 30 second timeout on most commands */
> -#define CLIENT_TIMEOUT (30*1000)
> -#define SHORT_TIMEOUT (5*1000)
> -
> /* value for unused fid field in trans2 secondary request */
> #define FID_UNUSED (0xFFFF)
>
> diff --git a/source3/client/clitar.c b/source3/client/clitar.c
> index d352571..7bbd6ad 100644
> --- a/source3/client/clitar.c
> +++ b/source3/client/clitar.c
> @@ -73,9 +73,6 @@ extern struct cli_state *cli;
>
> static uint16 attribute = FILE_ATTRIBUTE_DIRECTORY | FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN;
>
> -#ifndef CLIENT_TIMEOUT
> -#define CLIENT_TIMEOUT (30*1000)
> -#endif
>
> static char *tarbuf, *buffer_p;
> static int tp, ntarf, tbufsiz;
> diff --git a/source3/include/client.h b/source3/include/client.h
> index f6aacea..06d1bc9 100644
> --- a/source3/include/client.h
> +++ b/source3/include/client.h
> @@ -24,6 +24,11 @@
>
> #define CLI_BUFFER_SIZE (0xFFFF)
>
> +/* default client timeout to 20 seconds on most commands */
> +#define CLIENT_TIMEOUT (20 * 1000)
> +#define SHORT_TIMEOUT (5 * 1000)
> +
> +
> /*
> * These definitions depend on smb.h
> */
> diff --git a/source3/libsmb/clientgen.c b/source3/libsmb/clientgen.c
> index 6bc8d0c..98ea711 100644
> --- a/source3/libsmb/clientgen.c
> +++ b/source3/libsmb/clientgen.c
> @@ -26,6 +26,7 @@
> #include "async_smb.h"
> #include "../libcli/smb/smbXcli_base.h"
> #include "../librpc/ndr/libndr.h"
> +#include "../include/client.h"
>
> /*******************************************************************
> Setup the word count and byte count for a client smb message.
> @@ -175,7 +176,7 @@ struct cli_state *cli_state_create(TALLOC_CTX *mem_ctx,
> }
> cli->raw_status = NT_STATUS_INTERNAL_ERROR;
> cli->map_dos_errors = true; /* remove this */
> - cli->timeout = 20000; /* Timeout is in milliseconds. */
> + cli->timeout = CLIENT_TIMEOUT;
> cli->case_sensitive = false;
>
> /* Set the CLI_FORCE_DOSERR environment variable to test
> --
> 1.7.5.4
>
--
Thanks,
Steve
More information about the samba-technical
mailing list