]> git.neil.brown.name Git - history.git/commitdiff
IrDA: Correct fix for IrNET disconnect indication :
authorJean Tourrilhes <jt@hpl.hp.com>
Thu, 4 Apr 2002 00:01:01 +0000 (19:01 -0500)
committerLinus Torvalds <torvalds@penguin.transmeta.com>
Thu, 4 Apr 2002 00:01:01 +0000 (19:01 -0500)
if socket is not connected, don't hangup, to allow passive operation

net/irda/irnet/irnet.h
net/irda/irnet/irnet_irda.c

index c9cea4c3dd06aa98e476ac1a40ca02490fa1f275..f45b4e05695edf1c537d43023fdf3ea060e1ca42 100644 (file)
  *     o When receiving a disconnect indication, don't reenable the
  *       PPP Tx queue, this will trigger a reconnect. Instead, close
  *       the channel, which will kill pppd...
+ *
+ * v11 - 20.3.02 - Jean II
+ *     o Oops ! v10 fix disabled IrNET retries and passive behaviour.
+ *       Better fix in irnet_disconnect_indication() :
+ *       - if connected, kill pppd via hangup.
+ *       - if not connected, reenable ppp Tx, which trigger IrNET retry.
  */
 
 /***************************** INCLUDES *****************************/
index 7dcd6aaea9783f6c2db5004355de8d4b946e853b..43f6726290223d7fcf6cba985a1c06219fb6e0e8 100644 (file)
@@ -1070,7 +1070,7 @@ irnet_data_indication(void *      instance,
  *     o attempted to connect, timeout
  *     o connected, link is broken, LAP has timeout
  *     o connected, other side close the link
- *     o connection request on the server no handled
+ *     o connection request on the server not handled
  */
 static void
 irnet_disconnect_indication(void *     instance,
@@ -1121,20 +1121,31 @@ irnet_disconnect_indication(void *      instance,
       DEBUG(IRDA_CB_INFO, "Closing our TTP connection.\n");
       irttp_close_tsap(self->tsap);
       self->tsap = NULL;
-
-      /* Cleanup & close the PPP channel, which will kill pppd and the rest */
-      if(self->ppp_open)
-       ppp_unregister_channel(&self->chan);
-      self->ppp_open = 0;
     }
-  /* Cleanup the socket in case we want to reconnect */
+  /* Cleanup the socket in case we want to reconnect in ppp_output_wakeup() */
   self->stsap_sel = 0;
   self->daddr = DEV_ADDR_ANY;
   self->tx_flow = FLOW_START;
 
-  /* Note : what should we say to ppp ?
-   * It seem the ppp_generic and pppd are happy that way and will eventually
-   * timeout gracefully, so don't bother them... */
+  /* Deal with the ppp instance if it's still alive */
+  if(self->ppp_open)
+    {
+      if(test_open)
+       {
+         /* If we were connected, cleanup & close the PPP channel,
+          * which will kill pppd (hangup) and the rest */
+         ppp_unregister_channel(&self->chan);
+         self->ppp_open = 0;
+       }
+      else
+       {
+         /* If we were trying to connect, flush (drain) ppp_generic
+          * Tx queue (most often we have blocked it), which will
+          * trigger an other attempt to connect. If we are passive,
+          * this will empty the Tx queue after last try. */
+         ppp_output_wakeup(&self->chan);
+       }
+    }
 
   DEXIT(IRDA_TCB_TRACE, "\n");
 }