[thrift] Erlang thrift_sup will exit if it can't bind to the given address
authorChristopher Piro <cpiro@apache.org>
Wed, 20 Feb 2008 08:19:38 +0000 (08:19 +0000)
committerChristopher Piro <cpiro@apache.org>
Wed, 20 Feb 2008 08:19:38 +0000 (08:19 +0000)
Summary: before it would complain and not exit.  that's not right.

Reviewed By: eletuchy

Test Plan: DEATH ENSUES

Revert Plan: sounds reasonable

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665490 13f79535-47bb-0310-9956-ffa450edef68

lib/erl/src/thrift_sup.erl

index ab3f80e..8be57df 100644 (file)
@@ -36,5 +36,10 @@ init([Port, Handler, Processor]) ->
 thrift_start_link(SF = tErlServer, Port, Hnd, Pr, ST, TF, PF) ->
     Args = [Port, Hnd, Pr, ST, TF:new(), PF:new()],
     Pid = oop:start_new(SF, Args),
-    ?R0(Pid, effectful_serve),
+    case ?R0(Pid, effectful_serve) of
+        ok ->
+            ok;
+        {error, eaddrinuse} ->
+            exit(eaddrinuse)
+    end,
     {ok, Pid}.