add thrift_client:cast
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666475 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/alterl/src/thrift_client.erl b/lib/alterl/src/thrift_client.erl
index d6508bb..802c009 100644
--- a/lib/alterl/src/thrift_client.erl
+++ b/lib/alterl/src/thrift_client.erl
@@ -93,6 +93,10 @@
{exception, Exception} -> throw(Exception)
end.
+cast(Client, Function, Args)
+ when is_pid(Client), is_atom(Function), is_list(Args) ->
+ gen_server:cast(Client, {call, Function, Args}).
+
%% Sends a function call but does not read the result. This is useful
%% if you're trying to log non-async function calls to write-only
%% transports like thrift_disk_log_transport.
@@ -100,7 +104,6 @@
when is_pid(Client), is_atom(Function), is_list(Args) ->
gen_server:call(Client, {send_call, Function, Args}).
-
close(Client) when is_pid(Client) ->
gen_server:cast(Client, close).
@@ -180,6 +183,20 @@
%% {stop, Reason, State}
%% Description: Handling cast messages
%%--------------------------------------------------------------------
+handle_cast({call, Function, Args}, State = #state{service = Service,
+ protocol = Protocol,
+ seqid = SeqId}) ->
+ _Result =
+ try
+ ok = send_function_call(State, Function, Args),
+ receive_function_result(State, Function)
+ catch
+ Class:Reason ->
+ error_logger:error_msg("error ignored in handle_cast({cast,...},...): ~p:~p~n", [Class, Reason])
+ end,
+
+ {noreply, State};
+
handle_cast(close, State=#state{protocol = Protocol}) ->
%% error_logger:info_msg("thrift_client ~p received close", [self()]),
{stop,normal,State};