We all know that in order to implement a module based on a behaviour say gen_server, we need to declare the module as gen_server behavior and implement the following callbacks.
-behaviour(gen_server).
%% gen_server callbacks
-export([init/1,
handle_call/3,
handle_cast/2,
handle_info/2,
terminate/2,
code_change/3]).
ct_netconfc has defined a few ct-gen_conn callbacks without declaring any behaviour. Why is it? How will ct_gen_conn know that it has to call these callbacks?
-module(ct_netconfc).
%% ct_gen_conn callbacks
-export([init/3,
handle_msg/3,
handle_msg/2,
terminate/2,
close/1]).
Similarly, ct_netconfc has defined a few ct_conn_log callbacks without declaring any behaviour.
%% ct_conn_log callback
-export([format_data/2]).
Another query; who calls ct_netconfc:close? Is it ct_util_server as per code comment?
%% Called by ct_util_server to close registered connections before terminate.
close(Client) ->
ct_util_server:module_info
case get_handle(Client) of
{ok,Pid} ->
%% ......