Fix thrift_server to create transport and protocol inside the processor rather than inside the acceptor.
This fixes a process and file descriptor leak -- previously, the thrift_buffered_transport process was linked to the acceptor, which never died.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666409 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/alterl/src/thrift_processor.erl b/lib/alterl/src/thrift_processor.erl
index 8e077b8..d89b91c 100644
--- a/lib/alterl/src/thrift_processor.erl
+++ b/lib/alterl/src/thrift_processor.erl
@@ -7,17 +7,18 @@
%%%-------------------------------------------------------------------
-module(thrift_processor).
--export([start/4,init/4]).
+-export([start/3,init/3]).
-include("thrift_constants.hrl").
-include("thrift_protocol.hrl").
-record(state, {handler, in_protocol, out_protocol, service}).
-start(IProt, OProt, Service, Handler) ->
- spawn(thrift_processor, init, [IProt, OProt, Service, Handler]).
+start(ProtocolGenerator, Service, Handler) when is_function(ProtocolGenerator, 0) ->
+ spawn(thrift_processor, init, [ProtocolGenerator, Service, Handler]).
-init(IProt, OProt, Service, Handler) ->
+init(ProtocolGenerator, Service, Handler) ->
+ {ok, IProt, OProt} = ProtocolGenerator(),
io:format("Processor started~n"),
loop(#state{in_protocol = IProt,
out_protocol = OProt,