hop_relay:hop_create/1. From 2012?
This commit is contained in:
parent
0921a0f4f2
commit
9de426b929
|
@ -20,7 +20,18 @@
|
|||
-behaviour(gen_server).
|
||||
-export([init/1, terminate/2, code_change/3, handle_call/3, handle_cast/2, handle_info/2]).
|
||||
|
||||
-export([start_link/1]).
|
||||
-export([hop_create/1, start_link/1]).
|
||||
|
||||
hop_create([HostBin, PortBin]) ->
|
||||
Host = binary_to_list(HostBin),
|
||||
Port = list_to_integer(binary_to_list(PortBin)),
|
||||
case gen_tcp:connect(Host, Port, [{active, false}]) of
|
||||
{ok, Sock} ->
|
||||
{ok, Pid} = start_link([Sock]),
|
||||
{ok, []};
|
||||
{error, Reason} ->
|
||||
{error, iolist_to_binary(io_lib:format("Connect failed: ~p", [Reason]))}
|
||||
end.
|
||||
|
||||
start_link(Args) ->
|
||||
gen_server:start_link(?MODULE, Args, []).
|
||||
|
|
Loading…
Reference in New Issue