Skip to content
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

Merged
merged 4 commits into from
Apr 19, 2017
Merged

Conversation

fenek
Copy link
Member

@fenek fenek commented Apr 19, 2017

This PR improves BOSH interleaving support in escalus_bosh. It ensures message order and tracks requests better.

@@ -504,3 +572,14 @@ host_to_list({_,_,_,_} = IP4) -> inet_parse:ntoa(IP4);
host_to_list({_,_,_,_,_,_,_,_} = IP6) -> inet_parse:ntoa(IP6);

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

@@ -504,3 +572,14 @@ host_to_list({_,_,_,_} = IP4) -> inet_parse:ntoa(IP4);
host_to_list({_,_,_,_,_,_,_,_} = IP6) -> inet_parse:ntoa(IP6);

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

@@ -504,3 +572,14 @@ host_to_list({_,_,_,_} = IP4) -> inet_parse:ntoa(IP4);
host_to_list({_,_,_,_,_,_,_,_} = IP6) -> inet_parse:ntoa(IP6);

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

@@ -504,3 +572,14 @@ host_to_list({_,_,_,_} = IP4) -> inet_parse:ntoa(IP4);
host_to_list({_,_,_,_,_,_,_,_} = IP6) -> inet_parse:ntoa(IP6);

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

@@ -504,3 +572,14 @@ host_to_list({_,_,_,_} = IP4) -> inet_parse:ntoa(IP4);
host_to_list({_,_,_,_,_,_,_,_} = IP6) -> inet_parse:ntoa(IP6);

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

@@ -504,3 +572,14 @@ host_to_list({_,_,_,_} = IP4) -> inet_parse:ntoa(IP4);
host_to_list({_,_,_,_,_,_,_,_} = IP6) -> inet_parse:ntoa(IP6);

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

@@ -504,3 +572,14 @@ host_to_list({_,_,_,_} = IP4) -> inet_parse:ntoa(IP4);
host_to_list({_,_,_,_,_,_,_,_} = IP6) -> inet_parse:ntoa(IP6);

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

@@ -82,7 +93,7 @@ connect(Args) ->
{ok, Transport}.

send(#client{rcv_pid = Pid} = Socket, Elem) ->

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

@@ -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) ->

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

{_, true, false} -> NS
end,
{noreply, NNS};
handle_info(_, #state{ terminated = true } = S) ->

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

@@ -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}) ->

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

{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) ->

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

event_client = EventClient,
client = Client,
on_reply = OnReplyFun}}.


handle_call({send, Transport, Elem}, _From, State) ->

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

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) ->

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

Copy link
Contributor

@michalwski michalwski left a 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.

@fenek
Copy link
Member Author

fenek commented Apr 19, 2017

Let's wait for respective PR in MongooseIM to pass as well.

@fenek
Copy link
Member Author

fenek commented Apr 19, 2017

Build successful: esl/MongooseIM#1289

@michalwski michalwski merged commit 868afbb into master Apr 19, 2017
@michalwski michalwski deleted the fix-bosh-concurrency branch April 19, 2017 19:14
@michalwski
Copy link
Contributor

Thanks for the change! Now it's done the right way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants