hop:name/0. From 2012?

This commit is contained in:
Tony Garnock-Jones 2013-03-20 11:08:03 -04:00
parent dfcd70cb70
commit 0921a0f4f2
2 changed files with 5 additions and 3 deletions

View File

@ -17,7 +17,10 @@
-module(hop).
-export([register_idempotent/3, class_of/1, send/2, post/4]).
-export([name/0, register_idempotent/3, class_of/1, send/2, post/4]).
name() ->
list_to_binary(atom_to_list(node())).
register_idempotent(Name, Pid, ClassModule) ->
case global:register_name(Name, Pid) of

View File

@ -85,8 +85,7 @@ handle_cast({socket_control_transferred, Sock}, State0 = #state{sock = Sock}) ->
inet:setopts(Sock, [binary]),
request_data(Sock),
State1 = send([<<"hop">>], State0),
State2 = send([<<"subscribe">>, list_to_binary(atom_to_list(node())), <<>>, <<>>, <<>>, <<>>],
State1),
State2 = send([<<"subscribe">>, hop:name(), <<>>, <<>>, <<>>, <<>>], State1),
{noreply, State2};
handle_cast(_Request, State) ->
{stop, {bad_cast, _Request}, State}.