mirror of
https://github.com/processone/ejabberd.git
synced 2024-05-31 21:07:55 +02:00
improve ip fetching patch
SVN Revision: 1414
This commit is contained in:
parent
8032533f26
commit
8047ff0617
|
@ -1,3 +1,7 @@
|
||||||
|
2008-07-03 Christophe Romain <christophe.romain@process-one.net>
|
||||||
|
|
||||||
|
* src/web/ejabberd_http_poll.erl: improve ip fetching patch
|
||||||
|
|
||||||
2008-07-07 Badlop <badlop@process-one.net>
|
2008-07-07 Badlop <badlop@process-one.net>
|
||||||
|
|
||||||
* src/Makefile.in: Spool, config and log dirs: writtable by owner,
|
* src/Makefile.in: Spool, config and log dirs: writtable by owner,
|
||||||
|
|
|
@ -101,11 +101,9 @@ sockname(_) ->
|
||||||
{ok, ?NULL_PEER}.
|
{ok, ?NULL_PEER}.
|
||||||
|
|
||||||
peername({http_poll, FsmRef}) ->
|
peername({http_poll, FsmRef}) ->
|
||||||
gen_fsm:send_all_state_event(FsmRef, {peername, self()}),
|
case catch gen_fsm:sync_send_all_state_event(FsmRef, peername, 1000) of
|
||||||
%% XXX should improve that, but sync call seems not possible
|
{ok, IP} -> {ok, IP};
|
||||||
receive
|
_ -> {ok, ?NULL_PEER}
|
||||||
{peername, PeerName} -> {ok, PeerName}
|
|
||||||
after 1000 -> {ok, ?NULL_PEER}
|
|
||||||
end;
|
end;
|
||||||
peername(_) ->
|
peername(_) ->
|
||||||
{ok, ?NULL_PEER}.
|
{ok, ?NULL_PEER}.
|
||||||
|
@ -238,10 +236,6 @@ handle_event({activate, From}, StateName, StateData) ->
|
||||||
}}
|
}}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
handle_event({peername, From}, StateName, StateData) ->
|
|
||||||
From ! {peername, StateData#state.ip},
|
|
||||||
{next_state, StateName, StateData};
|
|
||||||
|
|
||||||
handle_event(_Event, StateName, StateData) ->
|
handle_event(_Event, StateName, StateData) ->
|
||||||
{next_state, StateName, StateData}.
|
{next_state, StateName, StateData}.
|
||||||
|
|
||||||
|
@ -309,6 +303,10 @@ handle_sync_event(http_get, _From, StateName, StateData) ->
|
||||||
Reply = {ok, StateData#state.output},
|
Reply = {ok, StateData#state.output},
|
||||||
{reply, Reply, StateName, StateData#state{output = ""}};
|
{reply, Reply, StateName, StateData#state{output = ""}};
|
||||||
|
|
||||||
|
handle_sync_event(peername, _From, StateName, StateData) ->
|
||||||
|
Reply = {ok, {peername, StateData#state.ip}},
|
||||||
|
{reply, Reply, StateName, StateData};
|
||||||
|
|
||||||
handle_sync_event(_Event, _From, StateName, StateData) ->
|
handle_sync_event(_Event, _From, StateName, StateData) ->
|
||||||
Reply = ok,
|
Reply = ok,
|
||||||
{reply, Reply, StateName, StateData}.
|
{reply, Reply, StateName, StateData}.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user