From 44f785ef6715a5a8466a3939de44ebd7810a38b6 Mon Sep 17 00:00:00 2001 From: David Reiss Date: Wed, 11 Jun 2008 01:03:37 +0000 Subject: [PATCH] Rename "Connector" to "ProtocolFactory" since that's what it is (response to review by eletuchy) git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666461 13f79535-47bb-0310-9956-ffa450edef68 --- lib/alterl/src/thrift_client.erl | 16 ++++++++-------- lib/alterl/src/thrift_socket_transport.erl | 8 ++++---- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/lib/alterl/src/thrift_client.erl b/lib/alterl/src/thrift_client.erl index a2cc56b3..bd93e29b 100644 --- a/lib/alterl/src/thrift_client.erl +++ b/lib/alterl/src/thrift_client.erl @@ -35,15 +35,15 @@ start_link(Host, Port, Service) when is_integer(Port), is_atom(Service) -> %% Backwards-compatible starter for the usual case of socket transports start_link(Host, Port, Service, Options) when is_integer(Port), is_atom(Service), is_list(Options) -> - {ok, Connector} = thrift_socket_transport:new_connector(Host, Port, Options), - start_link(Connector, Service). + {ok, ProtocolFactory} = thrift_socket_transport:new_protocol_factory(Host, Port, Options), + start_link(ProtocolFactory, Service). -%% Connector :: fun() -> thrift_protocol() -start_link(Connector, Service) - when is_function(Connector), is_atom(Service) -> +%% ProtocolFactory :: fun() -> thrift_protocol() +start_link(ProtocolFactory, Service) + when is_function(ProtocolFactory), is_atom(Service) -> case gen_server:start_link(?MODULE, [Service], []) of {ok, Pid} -> - case gen_server:call(Pid, {connect, Connector}) of + case gen_server:call(Pid, {connect, ProtocolFactory}) of ok -> {ok, Pid}; Error -> @@ -87,9 +87,9 @@ init([Service]) -> %% {stop, Reason, State} %% Description: Handling call messages %%-------------------------------------------------------------------- -handle_call({connect, Connector}, _From, +handle_call({connect, ProtocolFactory}, _From, State = #state{service = Service}) -> - case Connector() of + case ProtocolFactory() of {ok, Protocol} -> {reply, ok, State#state{protocol = Protocol, seqid = 0}}; diff --git a/lib/alterl/src/thrift_socket_transport.erl b/lib/alterl/src/thrift_socket_transport.erl index bdae28b9..0c65a224 100644 --- a/lib/alterl/src/thrift_socket_transport.erl +++ b/lib/alterl/src/thrift_socket_transport.erl @@ -6,7 +6,7 @@ new/2, write/2, read/2, flush/1, close/1, - new_connector/3]). + new_protocol_factory/3]). -record(data, {socket, recv_timeout=infinity}). @@ -47,14 +47,14 @@ close(#data{socket = Socket}) -> gen_tcp:close(Socket). -%%%% CONNECTOR GENERATION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%% FACTORY GENERATION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% -%% Generates a "connector" function - a fun which returns a Protocol instance. +%% Generates a "protocol factory" function - a fun which returns a Protocol instance. %% This can be passed to thrift_client:start_link in order to connect to a %% server over a socket. %% -new_connector(Host, Port, Options) -> +new_protocol_factory(Host, Port, Options) -> ConnectTimeout = proplists:get_value(connect_timeout, Options, infinity), InSockOpts = proplists:get_value(sockopts, Options, []), Framed = proplists:get_value(framed, Options, false), -- 2.17.1