patch-2.1.44 linux/net/x25/x25_out.c

Next file: linux/net/x25/x25_route.c
Previous file: linux/net/x25/x25_link.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.43/linux/net/x25/x25_out.c linux/net/x25/x25_out.c
@@ -1,5 +1,5 @@
 /*
- *	X.25 Packet Layer release 001
+ *	X.25 Packet Layer release 002
  *
  *	This is ALPHA test software. This code may break your machine, randomly fail to work with new 
  *	releases, misbehave and/or generally screw up. It might even work. 
@@ -14,6 +14,7 @@
  *
  *	History
  *	X.25 001	Jonathan Naylor	Started coding.
+ *	X.25 002	Jonathan Naylor	New timer architecture.
  */
 
 #include <linux/config.h>
@@ -129,7 +130,8 @@
 	unsigned short end;
 	int modulus;
 
-	del_timer(&sk->timer);
+	if (sk->protinfo.x25->state != X25_STATE_3)
+		return;
 
 	/*
 	 *	Transmit interrupt data.
@@ -140,38 +142,39 @@
 		x25_transmit_link(skb, sk->protinfo.x25->neighbour);
 	}
 
+	if (sk->protinfo.x25->condition & X25_COND_PEER_RX_BUSY)
+		return;
+
+	if (skb_peek(&sk->write_queue) == NULL)
+		return;
+
 	modulus = (sk->protinfo.x25->neighbour->extended) ? X25_EMODULUS : X25_SMODULUS;
 	end     = (sk->protinfo.x25->va + sk->protinfo.x25->facilities.winsize_out) % modulus;
 
+	if (sk->protinfo.x25->vs == end)
+		return;
+
 	/*
-	 *	Transmit normal stream data.
+	 * Transmit data until either we're out of data to send or
+	 * the window is full.
 	 */
-	if (!(sk->protinfo.x25->condition & X25_COND_PEER_RX_BUSY) &&
-	    sk->protinfo.x25->vs != end                            &&
-	    skb_peek(&sk->write_queue) != NULL) {
-		/*
-		 * Transmit data until either we're out of data to send or
-		 * the window is full.
-		 */
 
-		skb = skb_dequeue(&sk->write_queue);
+	skb = skb_dequeue(&sk->write_queue);
 
-		do {
-			/*
-			 * Transmit the frame.
-			 */
-			x25_send_iframe(sk, skb);
+	do {
+		/*
+		 * Transmit the frame.
+		 */
+		x25_send_iframe(sk, skb);
 
-			sk->protinfo.x25->vs = (sk->protinfo.x25->vs + 1) % modulus;
+		sk->protinfo.x25->vs = (sk->protinfo.x25->vs + 1) % modulus;
 
-		} while (sk->protinfo.x25->vs != end && (skb = skb_dequeue(&sk->write_queue)) != NULL);
+	} while (sk->protinfo.x25->vs != end && (skb = skb_dequeue(&sk->write_queue)) != NULL);
 
-		sk->protinfo.x25->vl         = sk->protinfo.x25->vr;
-		sk->protinfo.x25->condition &= ~X25_COND_ACK_PENDING;
-		sk->protinfo.x25->timer      = 0;
-	}
+	sk->protinfo.x25->vl         = sk->protinfo.x25->vr;
+	sk->protinfo.x25->condition &= ~X25_COND_ACK_PENDING;
 
-	x25_set_timer(sk);
+	x25_stop_timer(sk);
 }
 
 /*
@@ -188,7 +191,8 @@
 
 	sk->protinfo.x25->vl         = sk->protinfo.x25->vr;
 	sk->protinfo.x25->condition &= ~X25_COND_ACK_PENDING;
-	sk->protinfo.x25->timer      = 0;
+
+	x25_stop_timer(sk);
 }
 
 void x25_check_iframes_acked(struct sock *sk, unsigned short nr)

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov