mirror of
https://github.com/processone/ejabberd.git
synced 2024-10-31 15:21:38 +01:00
Fix some type errors
This commit is contained in:
parent
c0240e7249
commit
b7c7d2747b
@ -49,7 +49,7 @@
|
|||||||
-export_type([poll_socket/0]).
|
-export_type([poll_socket/0]).
|
||||||
|
|
||||||
-record(state,
|
-record(state,
|
||||||
{id, key, socket, output = <<"">>, input = <<"">>,
|
{id, key, socket, output = [], input = <<"">>,
|
||||||
waiting_input = false, last_receiver, http_poll_timeout,
|
waiting_input = false, last_receiver, http_poll_timeout,
|
||||||
timer}).
|
timer}).
|
||||||
|
|
||||||
@ -253,7 +253,7 @@ handle_event({activate, From}, StateName, StateData) ->
|
|||||||
Input ->
|
Input ->
|
||||||
Receiver = From,
|
Receiver = From,
|
||||||
Receiver !
|
Receiver !
|
||||||
{tcp, StateData#state.socket, iolist_to_binary(Input)},
|
{tcp, StateData#state.socket, Input},
|
||||||
{next_state, StateName,
|
{next_state, StateName,
|
||||||
StateData#state{input = <<"">>, waiting_input = false,
|
StateData#state{input = <<"">>, waiting_input = false,
|
||||||
last_receiver = Receiver}}
|
last_receiver = Receiver}}
|
||||||
@ -272,11 +272,8 @@ handle_event(_Event, StateName, StateData) ->
|
|||||||
%%----------------------------------------------------------------------
|
%%----------------------------------------------------------------------
|
||||||
handle_sync_event({send, Packet}, _From, StateName,
|
handle_sync_event({send, Packet}, _From, StateName,
|
||||||
StateData) ->
|
StateData) ->
|
||||||
Packet2 = if is_binary(Packet) -> (Packet);
|
Packet2 = iolist_to_binary(Packet),
|
||||||
true -> Packet
|
Output = StateData#state.output ++ [Packet2],
|
||||||
end,
|
|
||||||
Output = StateData#state.output ++
|
|
||||||
[lists:flatten(Packet2)],
|
|
||||||
Reply = ok,
|
Reply = ok,
|
||||||
{reply, Reply, StateName,
|
{reply, Reply, StateName,
|
||||||
StateData#state{output = Output}};
|
StateData#state{output = Output}};
|
||||||
@ -295,7 +292,7 @@ handle_sync_event({http_put, Key, NewKey, Packet},
|
|||||||
if Allow ->
|
if Allow ->
|
||||||
case StateData#state.waiting_input of
|
case StateData#state.waiting_input of
|
||||||
false ->
|
false ->
|
||||||
Input = [StateData#state.input | Packet],
|
Input = <<(StateData#state.input)/binary, Packet/binary>>,
|
||||||
Reply = ok,
|
Reply = ok,
|
||||||
{reply, Reply, StateName,
|
{reply, Reply, StateName,
|
||||||
StateData#state{input = Input, key = NewKey}};
|
StateData#state{input = Input, key = NewKey}};
|
||||||
@ -320,7 +317,7 @@ handle_sync_event(http_get, _From, StateName,
|
|||||||
StateData) ->
|
StateData) ->
|
||||||
Reply = {ok, StateData#state.output},
|
Reply = {ok, StateData#state.output},
|
||||||
{reply, Reply, StateName,
|
{reply, Reply, StateName,
|
||||||
StateData#state{output = <<"">>}};
|
StateData#state{output = []}};
|
||||||
handle_sync_event(_Event, _From, StateName,
|
handle_sync_event(_Event, _From, StateName,
|
||||||
StateData) ->
|
StateData) ->
|
||||||
Reply = ok, {reply, Reply, StateName, StateData}.
|
Reply = ok, {reply, Reply, StateName, StateData}.
|
||||||
|
Loading…
Reference in New Issue
Block a user