Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

fix global ack timeout issue (TSUN-215) #7

Merged
merged 2 commits into from

2 participants

@onlychoice

add field "proto_opts.global_ack_timeout" and use it if a global ack request is made

@nniclausse
Collaborator

your patch seems ok, i will merge it. What would be even nicer is to be able to set both timeout values using an tag.

@nniclausse nniclausse merged commit a8ace14 into from
@onlychoice
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 14 additions and 3 deletions.
  1. +2 −1  include/ts_profile.hrl
  2. +12 −2 src/tsung/ts_client.erl
View
3  include/ts_profile.hrl
@@ -59,7 +59,8 @@
-record(proto_opts,
{ssl_ciphers = negociate, % for ssl only
retry_timeout = 10, % retry sending in microsec
- idle_timeout = 600000,
+ idle_timeout = 600000, % timeout for local ack
+ global_ack_timeout = infinity, % timeout for global ack
tcp_rcv_size = 32768, % tcp buffers size
tcp_snd_size = 32768,
udp_rcv_size, % udp buffers size
View
14 src/tsung/ts_client.erl
@@ -224,7 +224,12 @@ handle_info({NetEvent, _Socket, Data}, wait_ack, State=#state_rcv{rate_limit=Tok
handle_next_action(NewState#state_rcv{socket=NewSocket,rate_limit=NewTokenParam,
ack_done=false});
false ->
- TimeOut=(NewState#state_rcv.proto_opts)#proto_opts.idle_timeout,
+ TimeOut = case (NewState#state_rcv.request)#ts_request.ack of
+ global ->
+ (NewState#state_rcv.proto_opts)#proto_opts.global_ack_timeout;
+ _ ->
+ (NewState#state_rcv.proto_opts)#proto_opts.idle_timeout
+ end,
{next_state, wait_ack, NewState#state_rcv{socket=NewSocket,rate_limit=NewTokenParam}, TimeOut}
end;
handle_info({erlang, _Socket, Data}, wait_ack, State) ->
@@ -233,7 +238,12 @@ handle_info({erlang, _Socket, Data}, wait_ack, State) ->
{NewState=#state_rcv{ack_done=true}, _Opts} ->
handle_next_action(NewState#state_rcv{ack_done=false});
{NewState, _Opts} ->
- TimeOut=(NewState#state_rcv.proto_opts)#proto_opts.idle_timeout,
+ TimeOut = case (NewState#state_rcv.request)#ts_request.ack of
+ global ->
+ (NewState#state_rcv.proto_opts)#proto_opts.global_ack_timeout;
+ _ ->
+ (NewState#state_rcv.proto_opts)#proto_opts.idle_timeout
+ end,
{next_state, wait_ack, NewState, TimeOut}
end;
handle_info({udp, Socket,_IP,_InPortNo, Data}, StateName, State) ->
Something went wrong with that request. Please try again.