]> granicus.if.org Git - ejabberd/commitdiff
* src/web/ejabberd_http_poll.erl: Timeout disconnection were not
authorMickaël Rémond <mickael.remond@process-one.net>
Mon, 15 May 2006 15:45:52 +0000 (15:45 +0000)
committerMickaël Rémond <mickael.remond@process-one.net>
Mon, 15 May 2006 15:45:52 +0000 (15:45 +0000)
properly handled after "active once" migration. This is now fixed.

SVN Revision: 566

ChangeLog
src/web/ejabberd_http_poll.erl

index 4c977bb1fbe59c895711e1dbb79d03fde432b7a9..3305aac55073af1adbf2ad7ce7b7d563ba77c9a2 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2006-05-15  Mickael Remond  <mickael.remond@process-one.net>
+
+       * src/web/ejabberd_http_poll.erl: Timeout disconnection were not
+       properly handled after "active once" migration. This is now fixed.
+       
 2006-05-07  Mickael Remond  <mickael.remond@process-one.net>
 
        * src/mod_configure.erl: Unknown tables or tables from now unused
@@ -14,7 +19,7 @@
        from the offline message table. This function is only available if
        offline message queue is stored in Mnesia internal database. The
        function delete_old_messages is not available in mod_offline_odbc.
-       
+
 2006-05-01  Mickael Remond  <mickael.remond@process-one.net>
 
        * src/ejabberd_ctl.erl: Unknown tables or tables from now unused
index 09d4555f899120da37bcf8461dad956e2c20dbe7..b16735a559139e1e2e4bbabac9b0db50e20bc764 100644 (file)
@@ -37,6 +37,7 @@
                output = "",
                input = "",
                waiting_input = false,
+               last_receiver,
                timer}).
 
 %-define(DBGFSM, true).
@@ -205,7 +206,9 @@ handle_sync_event(activate, From, StateName, StateData) ->
        Input ->
            From ! {tcp, {http_poll, self()}, list_to_binary(Input)},
            {reply, ok, StateName, StateData#state{input = "",
-                                                  waiting_input = false}}
+                                                  waiting_input = false,
+                                                  last_receiver = From
+                                                 }}
     end;
 
 handle_sync_event(stop, From, StateName, StateData) ->
@@ -243,6 +246,7 @@ handle_sync_event({http_put, Key, NewKey, Packet},
                    Reply = ok,
                    {reply, Reply, StateName,
                     StateData#state{waiting_input = false,
+                                    last_receiver = Receiver,
                                     key = NewKey,
                                     timer = Timer}}
            end;
@@ -287,9 +291,12 @@ terminate(Reason, StateName, StateData) ->
       end),
     case StateData#state.waiting_input of
        false ->
-           ok;
-       Receiver ->
-           gen_fsm:reply(Receiver, {error, closed})
+           case StateData#state.last_receiver of
+               undefined -> ok;
+               Receiver  -> Receiver ! {tcp_closed, {http_poll, self()}}
+           end;
+       {Receiver, _Tag} ->
+           Receiver ! {tcp_closed, {http_poll, self()}}
     end,
     ok.