Hi,

        Today, I've found a weird one. I had my IAS server LASP which
was stuck in CONN_PEND state. Nothing I could do could unstuck the
socket (short of restarting IrDA). Of course, beeeing the IAS server,
I could not connect to this box.
        Looking in the code, I don't really understand how it
happened, and it might be a very rare and weird race
condition. However I made a little patch that should unstuck to
socket, should that happen again.
        This patch is untested. I mean, with the patch, my IrDA stack
still work perfectly, but I could not reproduce the conditions leading
to that situation.
        That's it...

        Jean
diff -u -p linux/net/irda/irlmp_event.d7.c linux/net/irda/irlmp_event.c
--- linux/net/irda/irlmp_event.d7.c     Tue Feb 20 14:14:33 2001
+++ linux/net/irda/irlmp_event.c        Tue Feb 20 14:41:31 2001
@@ -472,8 +472,6 @@ static int irlmp_state_disconnected(stru
                irlmp_start_watchdog_timer(self, 5*HZ);
                break;
        case LM_CONNECT_INDICATION:
-               irlmp_next_lsap_state(self, LSAP_CONNECT_PEND);
-
                if (self->conn_skb) {
                        WARNING(__FUNCTION__ 
                                "(), busy with another request!\n");
@@ -481,6 +479,8 @@ static int irlmp_state_disconnected(stru
                }
                self->conn_skb = skb;
 
+               irlmp_next_lsap_state(self, LSAP_CONNECT_PEND);
+
                irlmp_do_lap_event(self->lap, LM_LAP_CONNECT_REQUEST, NULL);
                break;
        default:
@@ -562,6 +562,15 @@ static int irlmp_state_connect_pend(stru
        switch (event) {
        case LM_CONNECT_REQUEST:
                /* Keep state */
+               break;
+       case LM_CONNECT_INDICATION:
+               /* Will happen in some rare cases when the socket get stuck,
+                * the other side retries the connect request.
+                * We just unstuck the socket - Jean II */
+               IRDA_DEBUG(0, __FUNCTION__ "(), LM_CONNECT_INDICATION, "
+                          "LSAP stuck in CONNECT_PEND state...\n");
+               /* Keep state */
+               irlmp_do_lap_event(self->lap, LM_LAP_CONNECT_REQUEST, NULL);
                break;
        case LM_CONNECT_RESPONSE:
                IRDA_DEBUG(0, __FUNCTION__ "(), LM_CONNECT_RESPONSE, "

Reply via email to