23
23
% %% @copyright (C) 2015, <Carlos Andres Bolaños>, All Rights Reserved.
24
24
% %% @doc Main interface.
25
25
% %%-------------------------------------------------------------------
26
- -module (tcp_client ).
26
+ -module ('tcp-mgr' ).
27
27
28
28
% % API
29
29
-export ([start_link /4 , start_link /5 ]).
@@ -43,15 +43,15 @@ start_link(PoolName, Size, Address, Port) ->
43
43
-spec start_link (
44
44
atom (),
45
45
pos_integer (),
46
- tcp_client_socket :address (),
47
- tcp_client_socket :portnum (),
48
- tcp_client_socket :client_options ()
46
+ 'tcp-mgr-socket' :address (),
47
+ 'tcp-mgr-socket' :portnum (),
48
+ 'tcp-mgr-socket' :client_options ()
49
49
) -> gen :start_ret ().
50
50
start_link (PoolName , Size , Address , Port , Options ) ->
51
51
SizeArgs = [{size , Size },
52
52
{max_overflow , 0 }],
53
53
PoolArgs = [{name , {local , PoolName }},
54
- {worker_module , tcp_client_socket }] ++ SizeArgs ,
54
+ {worker_module , 'tcp-mgr-socket' }] ++ SizeArgs ,
55
55
WorkerArgs = [{address , Address },
56
56
{port , Port },
57
57
{options , Options }],
@@ -64,8 +64,8 @@ sync_send(PoolName, Msg) ->
64
64
% % @doc Sends a message on the current connection and waits until server
65
65
% % respose arrives. Works as Request/Response.
66
66
-spec sync_send (
67
- atom (), tcp_client_socket :message (), timeout ()
68
- ) -> tcp_client_socket :sync_reply ().
67
+ atom (), 'tcp-mgr-socket' :message (), timeout ()
68
+ ) -> 'tcp-mgr-socket' :sync_reply ().
69
69
sync_send (PoolName , Msg , Timeout ) ->
70
70
execute (PoolName , {sync_send , [Msg , Timeout ]}).
71
71
@@ -77,8 +77,8 @@ send(PoolName, Msg) ->
77
77
% % with a request id. Works asynchronously, and if the server sends
78
78
% % a response back, it is sent directly to the caller process.
79
79
-spec send (
80
- atom (), tcp_client_socket :message (), timeout ()
81
- ) -> tcp_client_socket :reply ().
80
+ atom (), 'tcp-mgr-socket' :message (), timeout ()
81
+ ) -> 'tcp-mgr-socket' :reply ().
82
82
send (PoolName , Msg , Timeout ) ->
83
83
execute (PoolName , {send , [Msg , Timeout ]}).
84
84
@@ -91,5 +91,5 @@ execute(PoolName, {Cmd, Args}) ->
91
91
poolboy :transaction (
92
92
PoolName ,
93
93
fun (Worker ) ->
94
- apply (tcp_client_socket , Cmd , [Worker | Args ])
94
+ apply ('tcp-mgr-socket' , Cmd , [Worker | Args ])
95
95
end ).
0 commit comments