On Tue, 17 Apr 2001 12:47:43 -0500, Andrew Sutton wrote:

> i forgot to ask... when will changes from this and other issues be
> merged back into the kernel or available for a patch? if it's a patch
> where can i get it?
> 
> thanks,

Here is a small patch that fixes my write event problem during
connection establishment, and it will now give a write event instead
of a read event. But I don't think it will fix your strange problem
tho'. I think that must be something else.

-- Dag


--- linux-2.4.3-ac5/net/irda/af_irda.c  Fri Apr 13 14:53:47 2001
+++ linux/net/irda/af_irda.c    Wed Apr 18 00:05:30 2001
@@ -219,7 +219,8 @@ static void irda_connect_confirm(void *i
 
        memcpy(&self->qos_tx, qos, sizeof(struct qos_info));
 
-       skb_queue_tail(&sk->receive_queue, skb);
+       /*skb_queue_tail(&sk->receive_queue, skb);*/
+       kfree_skb(skb);
 
        /* We are now connected! */
        sk->state = TCP_ESTABLISHED;
@@ -1623,34 +1624,54 @@ static unsigned int irda_poll(struct fil
 {
        struct sock *sk = sock->sk;
        unsigned int mask;
+       struct irda_sock *self;
 
        IRDA_DEBUG(4, __FUNCTION__ "()\n");
 
+       self = sk->protinfo.irda;
        poll_wait(file, sk->sleep, wait);
        mask = 0;
 
-       /* exceptional events? */
+       /* Exceptional events? */
        if (sk->err)
                mask |= POLLERR;
        if (sk->shutdown & RCV_SHUTDOWN)
                mask |= POLLHUP;
 
-       /* readable? */
+       /* Readable? */
        if (!skb_queue_empty(&sk->receive_queue)) {
                IRDA_DEBUG(4, "Socket is readable\n");
                mask |= POLLIN | POLLRDNORM;
        }
+
        /* Connection-based need to check for termination and startup */
-       if (sk->type == SOCK_STREAM && sk->state==TCP_CLOSE)
-               mask |= POLLHUP;
+       switch (sk->type) {
+       case SOCK_STREAM:
+               if (sk->state == TCP_CLOSE)
+                       mask |= POLLHUP;
 
-       /*
-        * we set writable also when the other side has shut down the
-        * connection. This prevents stuck sockets.
-        */
-       if (sk->sndbuf - (int)atomic_read(&sk->wmem_alloc) >= SOCK_MIN_WRITE_SPACE)
+               if (sk->state == TCP_ESTABLISHED) {
+                       if ((self->tx_flow == FLOW_START) && 
+                           (sk->sndbuf - (int)atomic_read(&sk->wmem_alloc) >= 
+SOCK_MIN_WRITE_SPACE))
+                       {
+                               mask |= POLLOUT | POLLWRNORM | POLLWRBAND;
+                       }
+               }
+               break;
+       case SOCK_SEQPACKET:
+               if ((self->tx_flow == FLOW_START) && 
+                   (sk->sndbuf - (int)atomic_read(&sk->wmem_alloc) >= 
+SOCK_MIN_WRITE_SPACE))
+               {       
                        mask |= POLLOUT | POLLWRNORM | POLLWRBAND;
-
+               }
+               break;
+       case SOCK_DGRAM:
+               if (sk->sndbuf - (int)atomic_read(&sk->wmem_alloc) >= 
+SOCK_MIN_WRITE_SPACE)
+                       mask |= POLLOUT | POLLWRNORM | POLLWRBAND;
+               break;
+       default:
+               break;
+       }               
        return mask;
 }
 

-- 
Dag Brattli,                     Mail:  [EMAIL PROTECTED]
CEO, ObexCode SUS                Web:   http://www.obexcode.com
Antenneveien 12                  Phone: +47 776 52 806
NO-9017 Tromsoe, NORWAY          Cell:  +47 481 06 352


_______________________________________________
Linux-IrDA mailing list  -  [EMAIL PROTECTED]
http://www.pasta.cs.UiT.No/mailman/listinfo/linux-irda

Reply via email to