<commit_before>-module(egambo_tcp_handler).

-include("egambo.hrl").

-behavior(etcpjson_srv).

% etcpjson_srv callbacks
-export([init/3, code_change/3, handle_call/3, handle_cast/2, handle_info/2,
         terminate/2]).

-record(state, {ip, port, srv}).

init(IP, Port, Srv) ->
    {ok, #state{ip = IP, port = Port, srv = Srv}}.

handle_info(Json, State) when is_map(Json) ->
    ?Info("Json data received: ~p", [Json]),
    {noreply, State};
handle_info(Request, State) -> 
    ?Info("Unsolicited handle_info in ~p : ~p", [?MODULE, Request]),
    {noreply, State}.

handle_cast(Request, State) ->
    ?Info("Unsolicited handle_cast in ~p : ~p", [?MODULE, Request]),
    {noreply, State}.

handle_call(Request, From, State) ->
    {stop, {unsupported_call, Request, From}, unsupported, State}.

terminate(Reason, #state{ip = IP, port = Port}) ->
    ?Info("terminate ~s:~p : ~p", [inet:ntoa(IP), Port, Reason]).

code_change(_OldVsn, State, _Extra) -> {ok, State}.<commit_msg>Added log on peer connection.<commit_after>-module(egambo_tcp_handler).

-include("egambo.hrl").

-behavior(etcpjson_srv).

% etcpjson_srv callbacks
-export([init/3, code_change/3, handle_call/3, handle_cast/2, handle_info/2,
         terminate/2]).

-record(state, {ip, port, srv}).

init(IP, Port, Srv) ->
    ?Info("peer connected ~s:~p", [inet:ntoa(IP), Port]),
    {ok, #state{ip = IP, port = Port, srv = Srv}}.

handle_info(Json, State) when is_map(Json) ->
    ?Info("Json data received: ~p", [Json]),
    {noreply, State};
handle_info(Request, State) -> 
    ?Info("Unsolicited handle_info in ~p : ~p", [?MODULE, Request]),
    {noreply, State}.

handle_cast(Request, State) ->
    ?Info("Unsolicited handle_cast in ~p : ~p", [?MODULE, Request]),
    {noreply, State}.

handle_call(Request, From, State) ->
    {stop, {unsupported_call, Request, From}, unsupported, State}.

terminate({shutdown, Reason}, State) -> terminate(Reason, State);
terminate(Reason, #state{ip = IP, port = Port}) ->
    ?Info("terminate ~s:~p : ~p", [inet:ntoa(IP), Port, Reason]).

code_change(_OldVsn, State, _Extra) -> {ok, State}.
{'fraction_non_alphanumeric': 0.1922709923664122, 'fraction_numerical': 0.0057251908396946565, 'mean_word_length': 4.376923076923077, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 18, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1974736', 'n_tokens_mistral': 804, 'n_tokens_neox': 772, 'n_words': 179}