1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
$NetBSD: patch-ah,v 1.2 2009/03/22 10:39:44 martti Exp $
Modified to use IPv6/v4 patch (https://support.process-one.net/browse/EJAB-389)
--- src/mod_proxy65/mod_proxy65_service.erl.orig 2009-03-12 08:41:02.000000000 +0000
+++ src/mod_proxy65/mod_proxy65_service.erl 2009-03-22 10:27:50.000000000 +0000
@@ -52,6 +52,7 @@
name,
stream_addr,
port,
+ ip,
acl
}).
@@ -69,14 +70,14 @@
gen_server:start_link({local, Proc}, ?MODULE, [Host, Opts], []).
init([Host, Opts]) ->
- {IP, State} = parse_options(Host, Opts),
- NewOpts = [Host, {ip, IP} | Opts],
- ejabberd_listener:add_listener(State#state.port, mod_proxy65_stream, NewOpts),
+ State = parse_options(Host, Opts),
+ NewOpts = [Host | Opts],
+ ejabberd_listener:add_listener({State#state.port, State#state.ip}, mod_proxy65_stream, NewOpts),
ejabberd_router:register_route(State#state.myhost),
{ok, State}.
-terminate(_Reason, #state{myhost=MyHost, port=Port}) ->
- catch ejabberd_listener:delete_listener(Port),
+terminate(_Reason, #state{myhost=MyHost, port=Port, ip=IP}) ->
+ catch ejabberd_listener:delete_listener({Port, IP}),
ejabberd_router:unregister_route(MyHost),
ok.
@@ -202,12 +203,13 @@
end,
StrIP = inet_parse:ntoa(IP),
StreamAddr = [{"jid", MyHost}, {"host", StrIP}, {"port", integer_to_list(Port)}],
- {IP, #state{myhost = MyHost,
+ #state{myhost = MyHost,
serverhost = ServerHost,
name = Name,
port = Port,
+ ip = IP,
stream_addr = StreamAddr,
- acl = ACL}}.
+ acl = ACL}.
get_my_ip() ->
{ok, MyHostName} = inet:gethostname(),
|