Change alterl thrift_server to use non-blocking TCP calls and properly set the processor as the controlling process for the client sockets.
Summary:
- Removes the non-OTP "acceptor" process
- The processor becomes the socket's controlling process instead of the transport, which is kind of messy, but it means we don't have to make a process for the socket_transport.
- See http://www.trapexit.org/Building_a_Non-blocking_TCP_server_using_OTP_principles for non-blocking server info
Test plan:
- Ran ThriftTest and StressTest
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666417 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/test/erl/Makefile b/test/erl/Makefile
index 017cdc1..42572d2 100644
--- a/test/erl/Makefile
+++ b/test/erl/Makefile
@@ -7,7 +7,7 @@
TARGETDIR=ebin
SRCDIR=src
-ALL_INCLUDEDIR=$(GEN_INCLUDEDIR) $(INCLUDEDIR) ../../lib/erl/include
+ALL_INCLUDEDIR=$(GEN_INCLUDEDIR) $(INCLUDEDIR) ../../lib/alterl/include
INCLUDEFLAGS=$(patsubst %,-I%, ${ALL_INCLUDEDIR})
MODULES = stress_server test_server
diff --git a/test/erl/src/stress_server.erl b/test/erl/src/stress_server.erl
index 915b027..d82f940 100644
--- a/test/erl/src/stress_server.erl
+++ b/test/erl/src/stress_server.erl
@@ -1,8 +1,7 @@
-module(stress_server).
--include("thrift.hrl").
--export([start_link/1, old_start_link/1,
+-export([start_link/1,
handle_function/2,
@@ -19,24 +18,6 @@
start_link(Port) ->
thrift_server:start_link(Port, service_thrift, ?MODULE).
-% Start the server with the old style bindings
-old_start_link(Port) ->
- Handler = ?MODULE,
- Processor = service_thrift,
-
- TF = tBufferedTransportFactory:new(),
- PF = tBinaryProtocolFactory:new(),
-
- ServerTransport = tErlAcceptor,
- ServerFlavor = tErlServer,
-
- Server = oop:start_new(ServerFlavor, [Port, Handler, Processor, ServerTransport, TF, PF]),
-
- case ?R0(Server, effectful_serve) of
- ok -> Server;
- Error -> Error
- end.
-
handle_function(Function, Args) ->
case apply(?MODULE, Function, tuple_to_list(Args)) of