Author: dreiss
Date: Tue Jun 10 18:00:30 2008
New Revision: 666437

URL: http://svn.apache.org/viewvc?rev=666437&view=rev
Log:
changing thrift_processor shutdown to compy with proc_lib standards

Modified:
    incubator/thrift/trunk/lib/alterl/src/thrift_buffered_transport.erl
    incubator/thrift/trunk/lib/alterl/src/thrift_processor.erl
    incubator/thrift/trunk/lib/alterl/src/thrift_socket_transport.erl
    incubator/thrift/trunk/lib/alterl/src/thrift_transport.erl

Modified: incubator/thrift/trunk/lib/alterl/src/thrift_buffered_transport.erl
URL: 
http://svn.apache.org/viewvc/incubator/thrift/trunk/lib/alterl/src/thrift_buffered_transport.erl?rev=666437&r1=666436&r2=666437&view=diff
==============================================================================
--- incubator/thrift/trunk/lib/alterl/src/thrift_buffered_transport.erl 
(original)
+++ incubator/thrift/trunk/lib/alterl/src/thrift_buffered_transport.erl Tue Jun 
10 18:00:30 2008
@@ -41,7 +41,6 @@
 new(WrappedTransport) ->
     case gen_server:start_link(?MODULE, [WrappedTransport], []) of
         {ok, Pid} ->
-%%             io:format("buffered transport ~p wrapping ~p", [Pid, 
WrappedTransport]),
             thrift_transport:new(?MODULE, Pid);
         Else ->
             Else
@@ -121,11 +120,11 @@
     thrift_transport:flush(Wrapped),
     {reply, Response, State#state{buffer = []}};
 
-handle_call(close, _From, State = #state{buffer  = Buffer,
+handle_call(close, From, State = #state{buffer  = Buffer,
                                          wrapped = Wrapped}) ->
     thrift_transport:write(Wrapped, concat_binary(lists:reverse(Buffer))),
-    thrift_transport:close(Wrapped),
-    {reply, ok, State}.
+    Close=thrift_transport:close(Wrapped),
+    {stop, shutdown, Close, State}.
 
 %%--------------------------------------------------------------------
 %% Function: handle_cast(Msg, State) -> {noreply, State} |

Modified: incubator/thrift/trunk/lib/alterl/src/thrift_processor.erl
URL: 
http://svn.apache.org/viewvc/incubator/thrift/trunk/lib/alterl/src/thrift_processor.erl?rev=666437&r1=666436&r2=666437&view=diff
==============================================================================
--- incubator/thrift/trunk/lib/alterl/src/thrift_processor.erl (original)
+++ incubator/thrift/trunk/lib/alterl/src/thrift_processor.erl Tue Jun 10 
18:00:30 2008
@@ -28,11 +28,12 @@
     case thrift_protocol:read(IProto, message_begin) of
         #protocol_message_begin{name = Function,
                                 type = ?tMessageType_CALL} ->
-            ok=handle_function(State, list_to_atom(Function)),
+            ok = handle_function(State, list_to_atom(Function)),
             loop(State);
         {error, closed} ->
             %% error_logger:info_msg("Client disconnected~n"),
-            exit(protocol_closed)
+            thrift_protocol:close_transport(OProto),
+            exit(shutdown)
     end.
 
 handle_function(State=#thrift_processor{in_protocol = IProto,
@@ -52,7 +53,6 @@
         handle_success(State, Function, Result)
     catch
         Type:Data ->
-            error_logger:info_msg("handle_function oh noes: ~p ~p", [Type, 
Data]),
             handle_function_catch(State, Function, Type, Data)
     end,
     after_reply(OProto).

Modified: incubator/thrift/trunk/lib/alterl/src/thrift_socket_transport.erl
URL: 
http://svn.apache.org/viewvc/incubator/thrift/trunk/lib/alterl/src/thrift_socket_transport.erl?rev=666437&r1=666436&r2=666437&view=diff
==============================================================================
--- incubator/thrift/trunk/lib/alterl/src/thrift_socket_transport.erl (original)
+++ incubator/thrift/trunk/lib/alterl/src/thrift_socket_transport.erl Tue Jun 
10 18:00:30 2008
@@ -37,4 +37,4 @@
 
 close(#data{socket = Socket}) ->
     gen_tcp:close(Socket),
-    exit(protocol_closed).
+    exit(normal).

Modified: incubator/thrift/trunk/lib/alterl/src/thrift_transport.erl
URL: 
http://svn.apache.org/viewvc/incubator/thrift/trunk/lib/alterl/src/thrift_transport.erl?rev=666437&r1=666436&r2=666437&view=diff
==============================================================================
--- incubator/thrift/trunk/lib/alterl/src/thrift_transport.erl (original)
+++ incubator/thrift/trunk/lib/alterl/src/thrift_transport.erl Tue Jun 10 
18:00:30 2008
@@ -16,7 +16,7 @@
      {close, 1}
     ].
 
--record(transport, { module, data }).
+-record(transport, {module, data}).
 
 new(Module, Data) when is_atom(Module) ->
     {ok, #transport{module = Module,


Reply via email to