Another whitespace rampage
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666477 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/alterl/COPYING b/lib/alterl/COPYING
index 039f21e..0101a7d 100644
--- a/lib/alterl/COPYING
+++ b/lib/alterl/COPYING
@@ -1,5 +1,5 @@
Thrift Software License
-Copyright (c) 2006- Facebook, Inc.
+Copyright (c) 2006- Facebook, Inc.
Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
diff --git a/lib/alterl/LICENSE b/lib/alterl/LICENSE
index 039f21e..0101a7d 100644
--- a/lib/alterl/LICENSE
+++ b/lib/alterl/LICENSE
@@ -1,5 +1,5 @@
Thrift Software License
-Copyright (c) 2006- Facebook, Inc.
+Copyright (c) 2006- Facebook, Inc.
Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
diff --git a/lib/alterl/README b/lib/alterl/README
index c1b2760..7147381 100644
--- a/lib/alterl/README
+++ b/lib/alterl/README
@@ -3,11 +3,11 @@
118> f(), {ok, C} = thrift_client:start_link("localhost", 9090, thriftTest_thrif
t).
{ok,<0.271.0>}
-119> thrift_client:call(C, testVoid, []).
+119> thrift_client:call(C, testVoid, []).
{ok,ok}
120> thrift_client:call(C, testVoid, [asdf]).
{error,{bad_args,testVoid,[asdf]}}
-121> thrift_client:call(C, testI32, [123]).
+121> thrift_client:call(C, testI32, [123]).
{ok,123}
122> thrift_client:call(C, testAsync, [1]).
{ok,ok}
@@ -17,7 +17,7 @@
{ok,ok}
125> catch thrift_client:call(C, testException, ["Xception"]).
{xception,1001,"This is an Xception"}
-126> thrift_client:call(C, testException, ["Xception"]).
+126> thrift_client:call(C, testException, ["Xception"]).
=ERROR REPORT==== 24-Feb-2008::23:00:23 ===
Error in process <0.269.0> with exit value: {{nocatch,{xception,1001,"This is an
diff --git a/lib/alterl/src/thrift_binary_protocol.erl b/lib/alterl/src/thrift_binary_protocol.erl
index fce6c42..e53f5ef 100644
--- a/lib/alterl/src/thrift_binary_protocol.erl
+++ b/lib/alterl/src/thrift_binary_protocol.erl
@@ -308,4 +308,4 @@
{strict_write, ParsedOpts#tbp_opts.strict_write}])
end,
{ok, F}.
-
+
diff --git a/lib/alterl/src/thrift_socket_server.erl b/lib/alterl/src/thrift_socket_server.erl
index 2bb9181..173fa79 100644
--- a/lib/alterl/src/thrift_socket_server.erl
+++ b/lib/alterl/src/thrift_socket_server.erl
@@ -15,19 +15,19 @@
-export([start/1, stop/1]).
-export([init/1, handle_call/3, handle_cast/2, terminate/2, code_change/3,
- handle_info/2]).
+ handle_info/2]).
-export([acceptor_loop/1]).
-record(thrift_socket_server,
- {port,
+ {port,
service,
handler,
- name,
- max=2048,
- ip=any,
- listen=null,
- acceptor=null,
+ name,
+ max=2048,
+ ip=any,
+ listen=null,
+ acceptor=null,
socket_opts=[{recv_timeout, 500}]
}).
@@ -70,14 +70,14 @@
parse_options(Rest, State#thrift_socket_server{port=Port});
parse_options([{ip, Ip} | Rest], State) ->
ParsedIp = case Ip of
- any ->
- any;
- Ip when is_tuple(Ip) ->
- Ip;
- Ip when is_list(Ip) ->
- {ok, IpTuple} = inet_parse:address(Ip),
- IpTuple
- end,
+ any ->
+ any;
+ Ip when is_tuple(Ip) ->
+ Ip;
+ Ip when is_list(Ip) ->
+ {ok, IpTuple} = inet_parse:address(Ip),
+ IpTuple
+ end,
parse_options(Rest, State#thrift_socket_server{ip=ParsedIp});
parse_options([{socket_opts, L} | Rest], State) when is_list(L), length(L) > 0 ->
parse_options(Rest, State#thrift_socket_server{socket_opts=L});
@@ -87,35 +87,35 @@
parse_options(Rest, State#thrift_socket_server{service=Service});
parse_options([{max, Max} | Rest], State) ->
MaxInt = case Max of
- Max when is_list(Max) ->
- list_to_integer(Max);
- Max when is_integer(Max) ->
- Max
- end,
+ Max when is_list(Max) ->
+ list_to_integer(Max);
+ Max when is_integer(Max) ->
+ Max
+ end,
parse_options(Rest, State#thrift_socket_server{max=MaxInt}).
start_server(State=#thrift_socket_server{name=Name}) ->
case Name of
- undefined ->
- gen_server:start_link(?MODULE, State, []);
- _ ->
- gen_server:start_link(Name, ?MODULE, State, [])
+ undefined ->
+ gen_server:start_link(?MODULE, State, []);
+ _ ->
+ gen_server:start_link(Name, ?MODULE, State, [])
end.
init(State=#thrift_socket_server{ip=Ip, port=Port}) ->
process_flag(trap_exit, true),
BaseOpts = [binary,
- {reuseaddr, true},
- {packet, 0},
- {backlog, 4096},
- {recbuf, 8192},
- {active, false}],
+ {reuseaddr, true},
+ {packet, 0},
+ {backlog, 4096},
+ {recbuf, 8192},
+ {active, false}],
Opts = case Ip of
- any ->
+ any ->
BaseOpts;
- Ip ->
- [{ip, Ip} | BaseOpts]
- end,
+ Ip ->
+ [{ip, Ip} | BaseOpts]
+ end,
case gen_tcp_listen(Port, Opts, State) of
{stop, eacces} ->
%% fdsrv module allows another shot to bind
@@ -144,11 +144,11 @@
gen_tcp_listen(Port, Opts, State) ->
case gen_tcp:listen(Port, Opts) of
{ok, Listen} ->
- {ok, ListenPort} = inet:port(Listen),
- {ok, new_acceptor(State#thrift_socket_server{listen=Listen,
+ {ok, ListenPort} = inet:port(Listen),
+ {ok, new_acceptor(State#thrift_socket_server{listen=Listen,
port=ListenPort})};
- {error, Reason} ->
- {stop, Reason}
+ {error, Reason} ->
+ {stop, Reason}
end.
new_acceptor(State=#thrift_socket_server{max=0}) ->
@@ -166,8 +166,8 @@
acceptor_loop({Server, Listen, Service, Handler, SocketOpts})
when is_pid(Server), is_list(SocketOpts) ->
case catch gen_tcp:accept(Listen) of % infinite timeout
- {ok, Socket} ->
- gen_server:cast(Server, {accepted, self()}),
+ {ok, Socket} ->
+ gen_server:cast(Server, {accepted, self()}),
ProtoGen = fun() ->
{ok, SocketTransport} = thrift_socket_transport:new(Socket, SocketOpts),
{ok, BufferedTransport} = thrift_buffered_transport:new(SocketTransport),
@@ -175,14 +175,14 @@
{ok, IProt=Protocol, OProt=Protocol}
end,
thrift_processor:init({Server, ProtoGen, Service, Handler});
- {error, closed} ->
- exit({error, closed});
- Other ->
- error_logger:error_report(
- [{application, thrift},
- "Accept failed error",
- lists:flatten(io_lib:format("~p", [Other]))]),
- exit({error, accept_failed})
+ {error, closed} ->
+ exit({error, closed});
+ Other ->
+ error_logger:error_report(
+ [{application, thrift},
+ "Accept failed error",
+ lists:flatten(io_lib:format("~p", [Other]))]),
+ exit({error, accept_failed})
end.
handle_call({get, port}, _From, State=#thrift_socket_server{port=Port}) ->
@@ -192,7 +192,7 @@
{reply, Res, State}.
handle_cast({accepted, Pid},
- State=#thrift_socket_server{acceptor=Pid, max=Max}) ->
+ State=#thrift_socket_server{acceptor=Pid, max=Max}) ->
% io:format("accepted ~p~n", [Pid]),
State1 = State#thrift_socket_server{max=Max - 1},
{noreply, new_acceptor(State1)};
@@ -213,27 +213,27 @@
State.
handle_info({'EXIT', Pid, normal},
- State=#thrift_socket_server{acceptor=Pid}) ->
+ State=#thrift_socket_server{acceptor=Pid}) ->
{noreply, new_acceptor(State)};
handle_info({'EXIT', Pid, Reason},
- State=#thrift_socket_server{acceptor=Pid}) ->
+ State=#thrift_socket_server{acceptor=Pid}) ->
error_logger:error_report({?MODULE, ?LINE,
- {acceptor_error, Reason}}),
+ {acceptor_error, Reason}}),
timer:sleep(100),
{noreply, new_acceptor(State)};
handle_info({'EXIT', _LoopPid, Reason},
- State=#thrift_socket_server{acceptor=Pid, max=Max}) ->
+ State=#thrift_socket_server{acceptor=Pid, max=Max}) ->
case Reason of
- normal -> ok;
+ normal -> ok;
shutdown -> ok;
- _ -> error_logger:error_report({?MODULE, ?LINE,
+ _ -> error_logger:error_report({?MODULE, ?LINE,
{child_error, Reason, erlang:get_stacktrace()}})
end,
State1 = State#thrift_socket_server{max=Max + 1},
State2 = case Pid of
- null -> new_acceptor(State1);
- _ -> State1
- end,
+ null -> new_acceptor(State1);
+ _ -> State1
+ end,
{noreply, State2};
handle_info(Info, State) ->
error_logger:info_report([{'INFO', Info}, {'State', State}]),