Compare commits
4 Commits
b5c8bf757d
...
6b53dd1526
| Author | SHA1 | Date | |
|---|---|---|---|
| 6b53dd1526 | |||
| c8b9337da8 | |||
| b33aeb8014 | |||
| 0238fbbd2a |
@@ -12,7 +12,7 @@ start_link(Socket) ->
|
|||||||
gen_server:start_link(?MODULE, Socket, []).
|
gen_server:start_link(?MODULE, Socket, []).
|
||||||
|
|
||||||
init(Socket) ->
|
init(Socket) ->
|
||||||
ssl:setopts(Socket, [{active, true}]),
|
ok = ssl:setopts(Socket, [{active, true}]),
|
||||||
{ok, #{socket => Socket}}.
|
{ok, #{socket => Socket}}.
|
||||||
|
|
||||||
handle_call(_Request, _From, State) ->
|
handle_call(_Request, _From, State) ->
|
||||||
@@ -26,7 +26,7 @@ handle_info({ssl, Socket, Data}, State) ->
|
|||||||
{ok, {foo, _}} ->
|
{ok, {foo, _}} ->
|
||||||
{ok, Encoded}
|
{ok, Encoded}
|
||||||
= 'StudySystemProtocol':encode('Response', {msg, "Foo"}),
|
= 'StudySystemProtocol':encode('Response', {msg, "Foo"}),
|
||||||
ssl:send(Socket, Encoded);
|
ok = ssl:send(Socket, Encoded);
|
||||||
Result ->
|
Result ->
|
||||||
io:format("Invalid message: ~p~n", [Result]),
|
io:format("Invalid message: ~p~n", [Result]),
|
||||||
ok
|
ok
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ handle_cast(_Msg, State) ->
|
|||||||
{noreply, State}.
|
{noreply, State}.
|
||||||
|
|
||||||
handle_info(accept, State = #state{socket = Socket}) ->
|
handle_info(accept, State = #state{socket = Socket}) ->
|
||||||
case ssl:transport_accept(Socket, 5000) of
|
case ssl:transport_accept(Socket) of
|
||||||
{ok, TlsSocket} ->
|
{ok, TlsSocket} ->
|
||||||
self() ! {handshake, TlsSocket},
|
self() ! {handshake, TlsSocket},
|
||||||
self() ! accept;
|
self() ! accept;
|
||||||
|
|||||||
Reference in New Issue
Block a user