Linux Headquarters
[ Register ]
[ About us ] [ Home Page ]

Advertisement
[ Kernel ] [ Documentation ] [ Links ] [ Books ]

Advertisement

Kernel v2.4.1 /net/x25/x25_timer.c

Filename:/net/x25/x25_timer.c
Lines Added:25
Lines Deleted:17
Also changed in: (Previous) 2.4.1-pre12  2.4.1-pre11  2.4.1-pre10  2.4.0-ac12  2.4.0-ac11  2.4.0-ac10 
(Following) 2.5.2-pre4  2.5.2-pre5  2.5.2-pre6  2.5.2-pre7  2.5.2-pre8  2.5.2-pre9 

Location
[  2.4.1
  [  net
    [  x25
       o  x25_timer.c

Patch

diff -u --recursive --new-file v2.4.0/linux/net/x25/x25_timer.c linux/net/x25/x25_timer.c
--- v2.4.0/linux/net/x25/x25_timer.c   Thu May  4 11:29:26 2000
+++ linux/net/x25/x25_timer.c   Wed Jan 24 15:28:36 2001
@@ -18,8 +18,6 @@
  *               Centralised disconnection processing.
  */
 
-#include <linux/config.h>
-#if defined(CONFIG_X25) || defined(CONFIG_X25_MODULE)
 #include <linux/errno.h>
 #include <linux/types.h>
 #include <linux/socket.h>
@@ -121,6 +119,11 @@
 {
    struct sock *sk = (struct sock *)param;
 
+        bh_lock_sock(sk);
+        if (sk->lock.users) { /* can currently only occur in state 3 */ 
+      goto restart_heartbeat;
+   }
+
    switch (sk->protinfo.x25->state) {
 
       case X25_STATE_0:
@@ -128,7 +131,7 @@
             is accepted() it isn't 'dead' so doesn't get removed. */
          if (sk->destroy || (sk->state == TCP_LISTEN && sk->dead)) {
             x25_destroy_socket(sk);
-            return;
+            goto unlock;
          }
          break;
 
@@ -136,29 +139,21 @@
          /*
           * Check for the state of the receive buffer.
           */
-         if (atomic_read(&sk->rmem_alloc) < (sk->rcvbuf / 2) &&
-             (sk->protinfo.x25->condition & X25_COND_OWN_RX_BUSY)) {
-            sk->protinfo.x25->condition &= ~X25_COND_OWN_RX_BUSY;
-            sk->protinfo.x25->condition &= ~X25_COND_ACK_PENDING;
-            sk->protinfo.x25->vl         = sk->protinfo.x25->vr;
-            x25_write_internal(sk, X25_RR);
-            x25_stop_timer(sk);
-            break;
-         }
+         x25_check_rbuf(sk);
          break;
    }
-
+ restart_heartbeat:
    x25_start_heartbeat(sk);
+ unlock:
+   bh_unlock_sock(sk);
 }
 
 /*
  *   Timer has expired, it may have been T2, T21, T22, or T23. We can tell
  *   by the state machine state.
  */
-static void x25_timer_expiry(unsigned long param)
+static inline void x25_do_timer_expiry(struct sock * sk)
 {
-   struct sock *sk = (struct sock *)param;
-
    switch (sk->protinfo.x25->state) {
 
       case X25_STATE_3:   /* T2 */
@@ -181,4 +176,17 @@
    }
 }
 
-#endif
+static void x25_timer_expiry(unsigned long param)
+{
+   struct sock *sk = (struct sock *)param;
+
+   bh_lock_sock(sk);
+   if (sk->lock.users) { /* can currently only occur in state 3 */
+      if (sk->protinfo.x25->state == X25_STATE_3) {
+         x25_start_t2timer(sk);
+      }
+   } else {
+      x25_do_timer_expiry(sk);
+   }
+   bh_unlock_sock(sk);
+}


Comments: webmaster (at) linuxhq.com.
Advertising: banners (at) linuxhq.com.
Compilation ©1998-2008 Linux Headquarters, Inc.