aboutsummaryrefslogtreecommitdiffstats
path: root/lib/orber/src/orber_socket.erl
diff options
context:
space:
mode:
authorLars Thorsen <[email protected]>2014-06-12 11:21:55 +0200
committerLars Thorsen <[email protected]>2014-06-23 08:49:24 +0200
commited3927c0db4b59cebdf10049f4b03a7e96383a88 (patch)
tree1c9576a951f9fb503e8c7d2d95f55a0a42ec9da4 /lib/orber/src/orber_socket.erl
parent1af8998028f77b4ca01c52972a5983b072ef02d1 (diff)
downloadotp-ed3927c0db4b59cebdf10049f4b03a7e96383a88.tar.gz
otp-ed3927c0db4b59cebdf10049f4b03a7e96383a88.tar.bz2
otp-ed3927c0db4b59cebdf10049f4b03a7e96383a88.zip
[orber] Add possibilty to configure orber to run in both IPv4 and IPv6
Diffstat (limited to 'lib/orber/src/orber_socket.erl')
-rw-r--r--lib/orber/src/orber_socket.erl39
1 files changed, 16 insertions, 23 deletions
diff --git a/lib/orber/src/orber_socket.erl b/lib/orber/src/orber_socket.erl
index 07a0e09ccc..5c79100b94 100644
--- a/lib/orber/src/orber_socket.erl
+++ b/lib/orber/src/orber_socket.erl
@@ -205,29 +205,26 @@ listen(normal, Port, Options, Exception) ->
MaxSize ->
[{packet_size, MaxSize}|Options2]
end,
- case catch gen_tcp:listen(Port, [binary, {packet,cdr}, {keepalive, Keepalive},
+ Options4 = [binary, {packet,cdr}, {keepalive, Keepalive},
{reuseaddr,true}, {backlog, Backlog} |
- Options3]) of
+ Options3],
+ case catch gen_tcp:listen(Port, Options4) of
{ok, ListenSocket} ->
{ok, ListenSocket, check_port(Port, normal, ListenSocket)};
{error, Reason} when Exception == false ->
{error, Reason};
{error, eaddrinuse} ->
- AllOpts = [binary, {packet,cdr},
- {reuseaddr,true} | Options3],
orber:dbg("[~p] orber_socket:listen(normal, ~p, ~p);~n"
"Looks like the listen port is already in use.~n"
"Check if another Orber is started~n"
"on the same node and uses the same listen port (iiop_port). But it may also~n"
"be used by any other application; confirm with 'netstat'.",
- [?LINE, Port, AllOpts], ?DEBUG_LEVEL),
+ [?LINE, Port, Options4], ?DEBUG_LEVEL),
corba:raise(#'COMM_FAILURE'{completion_status=?COMPLETED_NO});
Error ->
- AllOpts = [binary, {packet,cdr},
- {reuseaddr,true} | Options3],
orber:dbg("[~p] orber_socket:listen(normal, ~p, ~p);~n"
"Failed with reason: ~p",
- [?LINE, Port, AllOpts, Error], ?DEBUG_LEVEL),
+ [?LINE, Port, Options4, Error], ?DEBUG_LEVEL),
corba:raise(#'COMM_FAILURE'{completion_status=?COMPLETED_NO})
end;
listen(ssl, Port, Options, Exception) ->
@@ -252,26 +249,24 @@ listen(ssl, Port, Options, Exception) ->
true ->
Options3
end,
- case catch ssl:listen(Port, [binary, {packet,cdr},
- {backlog, Backlog} | Options4]) of
+ Options5 = [binary, {packet,cdr}, {backlog, Backlog} | Options4],
+ case catch ssl:listen(Port, Options5) of
{ok, ListenSocket} ->
{ok, ListenSocket, check_port(Port, ssl, ListenSocket)};
{error, Reason} when Exception == false ->
{error, Reason};
{error, eaddrinuse} ->
- AllOpts = [binary, {packet,cdr} | Options4],
orber:dbg("[~p] orber_socket:listen(ssl, ~p, ~p);~n"
"Looks like the listen port is already in use. Check if~n"
"another Orber is started on the same node and uses the~n"
"same listen port (iiop_port). But it may also~n"
"be used by any other application; confirm with 'netstat'.",
- [?LINE, Port, AllOpts], ?DEBUG_LEVEL),
+ [?LINE, Port, Options5], ?DEBUG_LEVEL),
corba:raise(#'COMM_FAILURE'{completion_status=?COMPLETED_NO});
Error ->
- AllOpts = [binary, {packet,cdr} | Options4],
orber:dbg("[~p] orber_socket:listen(ssl, ~p, ~p);~n"
"Failed with reason: ~p",
- [?LINE, Port, AllOpts, Error], ?DEBUG_LEVEL),
+ [?LINE, Port, Options5, Error], ?DEBUG_LEVEL),
corba:raise(#'COMM_FAILURE'{completion_status=?COMPLETED_NO})
end.
@@ -485,16 +480,14 @@ check_port(Port, _, _) ->
%%-----------------------------------------------------------------
%% Check Options.
check_options(normal, Options, _Generation) ->
- [orber:ip_version()|Options];
+ Options;
check_options(ssl, Options, Generation) ->
- case orber:ip_version() of
- inet when Generation > 2 ->
+ if
+ Generation > 2 ->
[{ssl_imp, new}|Options];
- inet ->
- [{ssl_imp, old}|Options];
- inet6 when Generation > 2 ->
- [{ssl_imp, new}, inet6|Options];
- inet6 ->
- [{ssl_imp, old}, inet6|Options]
+ true ->
+ [{ssl_imp, old}|Options]
end.
+
+