Compare commits

...

4 Commits

3 changed files with 7 additions and 7 deletions

View File

@@ -11,9 +11,9 @@ start_link(Port, CertDir) ->
supervisor:start_link({local, ?MODULE}, ?MODULE, [Port, CertDir]).
init([Port, CertDir]) ->
SupFlags = #{stragegy => one_for_one,
intensity => 1,
period => 5},
SupFlags = #{strategy => one_for_one,
intensity => 5,
period => 10},
ChildSpecs = [#{id => session_sup,
start => {session_sup, start_link, []},
restart => permanent,

View File

@@ -12,7 +12,7 @@ start_link(Socket) ->
gen_server:start_link(?MODULE, Socket, []).
init(Socket) ->
ssl:setopts(Socket, [{active, true}]),
ok = ssl:setopts(Socket, [{active, true}]),
{ok, #{socket => Socket}}.
handle_call(_Request, _From, State) ->
@@ -26,7 +26,7 @@ handle_info({ssl, Socket, Data}, State) ->
{ok, {foo, _}} ->
{ok, Encoded}
= 'StudySystemProtocol':encode('Response', {msg, "Foo"}),
ssl:send(Socket, Encoded);
ok = ssl:send(Socket, Encoded);
Result ->
io:format("Invalid message: ~p~n", [Result]),
ok

View File

@@ -8,7 +8,7 @@
-export([init/1, handle_call/3, handle_cast/2, handle_info/2,
terminate/2, code_change/3]).
-record(state, {socket, acceptor}).
-record(state, {socket}).
start_link(Port, CertDir) ->
gen_server:start_link({local, ?MODULE}, ?MODULE, [Port, CertDir], []).
@@ -39,7 +39,7 @@ handle_info(accept, State = #state{socket = Socket}) ->
end,
{noreply, State};
handle_info({handshake, TlsSocket}, State) ->
case ssl:handshake(TlsSocket) of
case ssl:handshake(TlsSocket, 5000) of
{ok, ClientSocket} ->
{ok, Pid} = session_sup:start_session(ClientSocket),
ok = ssl:controlling_process(ClientSocket, Pid);