ppp: Refactor how tls/tlu/tld/tlf are used
authorDenis Kenzior <denkenz@gmail.com>
Tue, 13 Apr 2010 19:00:01 +0000 (14:00 -0500)
committerDenis Kenzior <denkenz@gmail.com>
Tue, 13 Apr 2010 19:00:01 +0000 (14:00 -0500)
With the upper layer driving these, the special handling is no longer
required.

gatchat/ppp_cp.c

index 6d088eb..8cbb64f 100644 (file)
@@ -640,12 +640,6 @@ static void pppcp_generate_event(struct pppcp_data *data,
        if (actions & INV)
                goto error;
 
-       if (actions & TLD)
-               pppcp_this_layer_down(data);
-
-       if (actions & TLF)
-               pppcp_this_layer_finished(data);
-
        if (actions & IRC) {
                struct pppcp_timer_data *timer_data;
 
@@ -677,17 +671,16 @@ static void pppcp_generate_event(struct pppcp_data *data,
        if (actions & SER)
                pppcp_send_echo_reply(data, packet);
 
-       if (actions & TLU)
-               pppcp_this_layer_up(data);
-
        pppcp_transition_state(new_state, data);
 
-       /*
-        * The logic elsewhere generates the UP events when this is
-        * signaled.  So we must call this last
-        */
        if (actions & TLS)
                pppcp_this_layer_started(data);
+       else if (actions & TLU)
+               pppcp_this_layer_up(data);
+       else if (actions & TLD)
+               pppcp_this_layer_down(data);
+       else if (actions & TLF)
+               pppcp_this_layer_finished(data);
 
        return;