-
Notifications
You must be signed in to change notification settings - Fork 76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve concurrency in escalus_bosh (+fixes) #144
Conversation
src/escalus_bosh.erl
Outdated
@@ -504,3 +572,14 @@ host_to_list({_,_,_,_} = IP4) -> inet_parse:ntoa(IP4); | |||
host_to_list({_,_,_,_,_,_,_,_} = IP6) -> inet_parse:ntoa(IP6); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to Elvis:
Missing space right "," on line 572
src/escalus_bosh.erl
Outdated
@@ -504,3 +572,14 @@ host_to_list({_,_,_,_} = IP4) -> inet_parse:ntoa(IP4); | |||
host_to_list({_,_,_,_,_,_,_,_} = IP6) -> inet_parse:ntoa(IP6); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to Elvis:
Missing space right "," on line 572
src/escalus_bosh.erl
Outdated
@@ -504,3 +572,14 @@ host_to_list({_,_,_,_} = IP4) -> inet_parse:ntoa(IP4); | |||
host_to_list({_,_,_,_,_,_,_,_} = IP6) -> inet_parse:ntoa(IP6); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to Elvis:
Missing space right "," on line 572
src/escalus_bosh.erl
Outdated
@@ -504,3 +572,14 @@ host_to_list({_,_,_,_} = IP4) -> inet_parse:ntoa(IP4); | |||
host_to_list({_,_,_,_,_,_,_,_} = IP6) -> inet_parse:ntoa(IP6); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to Elvis:
Missing space right "," on line 572
src/escalus_bosh.erl
Outdated
@@ -504,3 +572,14 @@ host_to_list({_,_,_,_} = IP4) -> inet_parse:ntoa(IP4); | |||
host_to_list({_,_,_,_,_,_,_,_} = IP6) -> inet_parse:ntoa(IP6); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to Elvis:
Missing space right "," on line 572
src/escalus_bosh.erl
Outdated
@@ -504,3 +572,14 @@ host_to_list({_,_,_,_} = IP4) -> inet_parse:ntoa(IP4); | |||
host_to_list({_,_,_,_,_,_,_,_} = IP6) -> inet_parse:ntoa(IP6); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to Elvis:
Missing space right "," on line 572
src/escalus_bosh.erl
Outdated
@@ -504,3 +572,14 @@ host_to_list({_,_,_,_} = IP4) -> inet_parse:ntoa(IP4); | |||
host_to_list({_,_,_,_,_,_,_,_} = IP6) -> inet_parse:ntoa(IP6); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to Elvis:
Missing space right "," on line 572
src/escalus_bosh.erl
Outdated
@@ -82,7 +93,7 @@ connect(Args) -> | |||
{ok, Transport}. | |||
|
|||
send(#client{rcv_pid = Pid} = Socket, Elem) -> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to Compiler:
Warning: missing specification for function send/2
src/escalus_bosh.erl
Outdated
@@ -241,6 +255,11 @@ recv(#client{rcv_pid = Pid}) -> | |||
get_requests(#client{rcv_pid = Pid}) -> | |||
gen_server:call(Pid, get_requests). | |||
|
|||
%% This flag makes client to fail on stream error, | |||
%% even if it arrives out of order (according to RIDs) | |||
set_quickfail(#client{rcv_pid = Pid}, QuickfailFlag) -> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to Compiler:
Warning: missing specification for function set_quickfail/2
src/escalus_bosh.erl
Outdated
{_, true, false} -> NS | ||
end, | ||
{noreply, NNS}; | ||
handle_info(_, #state{ terminated = true } = S) -> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to Compiler:
Warning: missing specification for function handle_info/2
src/escalus_bosh.erl
Outdated
@@ -82,7 +93,7 @@ connect(Args) -> | |||
{ok, Transport}. | |||
|
|||
send(#client{rcv_pid = Pid} = Socket, Elem) -> | |||
gen_server:cast(Pid, {send, Socket, Elem}). | |||
gen_server:call(Pid, {send, Socket, Elem}). | |||
|
|||
is_connected(#client{rcv_pid = Pid}) -> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to Compiler:
Warning: missing specification for function is_connected/1
src/escalus_bosh.erl
Outdated
{stop, normal, ok, NewState}. | ||
Ref = make_ref(), | ||
NewState = wrap_and_send(transport(State), exml:to_iolist(StreamEnd), Ref, State), | ||
{noreply, NewState#state{ waiting_requesters = [{Ref, From} | WaitingRequesters] }}. | ||
|
||
handle_cast(stop, State) -> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to Compiler:
Warning: missing specification for function handle_cast/2
src/escalus_bosh.erl
Outdated
event_client = EventClient, | ||
client = Client, | ||
on_reply = OnReplyFun}}. | ||
|
||
|
||
handle_call({send, Transport, Elem}, _From, State) -> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to Compiler:
Warning: missing specification for function handle_call/3
src/escalus_bosh.erl
Outdated
already_stopped; | ||
exit:{timeout, {gen_server, call, _}} -> | ||
error({timeout, process_info(Pid, current_stacktrace), | ||
process_info(Pid, messages), catch sys:get_state(Pid)}) | ||
end. | ||
|
||
kill(#client{} = Client) -> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to Compiler:
Warning: missing specification for function kill/1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. Waiting for travis to pass.
Let's wait for respective PR in MongooseIM to pass as well. |
Build successful: esl/MongooseIM#1289 |
Thanks for the change! Now it's done the right way. |
This PR improves BOSH interleaving support in
escalus_bosh
. It ensures message order and tracks requests better.