mirror of
https://github.com/processone/ejabberd.git
synced 2024-12-20 17:27:00 +01:00
Improve ip fetching patch (thanks to Christohpe Romain)
SVN Revision: 2241
This commit is contained in:
parent
2d9f715d65
commit
e9ee9959a1
@ -4,7 +4,7 @@
|
||||
%%% Purpose : Implements XMPP over BOSH (XEP-0205) (formerly known as
|
||||
%%% HTTP Binding)
|
||||
%%% Created : 21 Sep 2005 by Stefan Strigler <steve@zeank.in-berlin.de>
|
||||
%%% Id : $Id: ejabberd_http_bind.erl 674 2008-07-03 15:58:15Z cromain $
|
||||
%%% Id : $Id: ejabberd_http_bind.erl 683 2008-07-08 10:30:45Z cromain $
|
||||
%%%----------------------------------------------------------------------
|
||||
|
||||
-module(ejabberd_http_bind).
|
||||
@ -119,11 +119,9 @@ sockname(_Socket) ->
|
||||
{ok, ?NULL_PEER}.
|
||||
|
||||
peername({http_bind, FsmRef}) ->
|
||||
gen_fsm:send_all_state_event(FsmRef, {peername, self()}),
|
||||
%% XXX should improve that, but sync call seems not possible
|
||||
receive
|
||||
{peername, PeerName} -> {ok, PeerName}
|
||||
after 1000 -> {ok, ?NULL_PEER}
|
||||
case catch gen_fsm:sync_send_all_state_event(FsmRef, peername, 1000) of
|
||||
{ok, IP} -> {ok, IP};
|
||||
_ -> {ok, ?NULL_PEER}
|
||||
end;
|
||||
peername(_) ->
|
||||
{ok, ?NULL_PEER}.
|
||||
@ -281,10 +279,6 @@ handle_event({activate, From}, StateName, StateData) ->
|
||||
last_receiver = Receiver}}
|
||||
end;
|
||||
|
||||
handle_event({peername, From}, StateName, StateData) ->
|
||||
From ! {peername, StateData#state.ip},
|
||||
{next_state, StateName, StateData};
|
||||
|
||||
handle_event(_Event, StateName, StateData) ->
|
||||
{next_state, StateName, StateData}.
|
||||
|
||||
@ -622,6 +616,10 @@ handle_sync_event({http_get, Rid, Wait, Hold}, From, StateName, StateData) ->
|
||||
req_list = ReqList}}
|
||||
end;
|
||||
|
||||
handle_sync_event(peername, _From, StateName, StateData) ->
|
||||
Reply = {ok, StateData#state.ip},
|
||||
{reply, Reply, StateName, StateData};
|
||||
|
||||
handle_sync_event(_Event, _From, StateName, StateData) ->
|
||||
Reply = ok,
|
||||
{reply, Reply, StateName, StateData}.
|
||||
|
Loading…
Reference in New Issue
Block a user