Allowing the timeout in source4/libcli/raw/clisocket.c to be set from an environment var

Richard Sharpe realrichardsharpe at gmail.com
Thu Sep 10 14:49:53 UTC 2015


On Thu, Sep 10, 2015 at 7:35 AM, Scott Lovenberg
<scott.lovenberg at gmail.com> wrote:
> On Wed, Sep 9, 2015 at 7:44 PM, Richard Sharpe
> <realrichardsharpe at gmail.com> wrote:
>> Hi folks,
>>
>> Is this of any use to people?
>>
>> diff --git a/source4/libcli/raw/clisocket.c b/source4/libcli/raw/clisocket.c
>> index dd3ea39..9a35636 100644
>> --- a/source4/libcli/raw/clisocket.c
>> +++ b/source4/libcli/raw/clisocket.c
>> @@ -262,6 +262,8 @@ struct sock_connect_state {
>>  /*
>>    connect a smbcli_socket context to an IP/port pair
>>    if port is 0 then choose 445 then 139
>> +
>> +  Timeout can be in msec and in the env.
>>  */
>>
>>  static struct tevent_req *smbcli_sock_establish_send(TALLOC_CTX *mem_ctx,
>> @@ -274,6 +276,10 @@ static struct tevent_req *smbcli_sock_establish_send(TALLOC
>>                 talloc_get_type_abort(private_data,
>>                 struct sock_connect_state);
>>         uint32_t timeout_msec = 15 * 1000;
>> +       int env_timeout = atoi(getenv("TORTURE_IO_TIMEOUT"));
>> +
>> +       if (env_timeout > 0)
>> +               timeout_msec = env_timeout;
>>
>>         return smbcli_transport_connect_send(state,
>>                                              ev,
>>
>
> Richard,
> Is this intended only for the torture tests or all client connections?
> I could really see the use in this for tests that flap and/or are
> racy, no doubt.

Well, my motivation was to allow changing the timeout on nbench tests,
but it could have more uses.

-- 
Regards,
Richard Sharpe
(何以解憂?唯有杜康。--曹操)



More information about the samba-technical mailing list