Skip to content
This repository has been archived by the owner on Apr 22, 2024. It is now read-only.

Store multistream handler selected in pdict #448

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/libp2p_multistream_client.erl
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ negotiate_handler(Handlers0, Path, Connection) ->
{error, Error} ->
lager:notice("Failed to negotiate handler for ~p: ~p", [Path, Error]),
{error, Error};
{_, Handler} -> {ok, Handler}
{_, Handler = {_Path, {M, _F}}} ->
put('__multistream_client_handler', M),
{ok, Handler}
end
end.

Expand Down
1 change: 1 addition & 0 deletions src/libp2p_multistream_server.erl
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ handle_msg(Msg, State) ->
{noreply, NewState} ->
loop(NewState);
{exec, M, F, A} ->
put('__multistream_server_handler', M),
erlang:cancel_timer(State#state.timeout),
try erlang:apply(M, F, A) of
Result -> Result
Expand Down