]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
BGP: split tx explicitly
authorMaria Jan Matejka <mq@jmq.cz>
Tue, 11 Jun 2019 09:35:25 +0000 (09:35 +0000)
committerMaria Jan Matejka <mq@jmq.cz>
Tue, 11 Jun 2019 09:39:00 +0000 (09:39 +0000)
If BGP has too many data to send and BIRD is slower than the link, TX is
always possible until all data is sent. This patch limits maximum number
of generated BGP messages in one iteration of TX hook.

proto/bgp/packets.c

index 2248b9f95f953c780b21a1d93f84ef68fa1f3e65..665a22c129573da4f214ab624577832ac9697ca1 100644 (file)
@@ -784,8 +784,12 @@ bgp_kick_tx(void *vconn)
   struct bgp_conn *conn = vconn;
 
   DBG("BGP: kicking TX\n");
-  while (bgp_fire_tx(conn) > 0)
+  uint max = 1024;
+  while (--max && (bgp_fire_tx(conn) > 0))
     ;
+
+  if (!max && !ev_active(conn->tx_ev))
+    ev_schedule(conn->tx_ev);
 }
 
 void
@@ -794,8 +798,12 @@ bgp_tx(sock *sk)
   struct bgp_conn *conn = sk->data;
 
   DBG("BGP: TX hook\n");
-  while (bgp_fire_tx(conn) > 0)
+  uint max = 1024;
+  while (--max && (bgp_fire_tx(conn) > 0))
     ;
+
+  if (!max && !ev_active(conn->tx_ev))
+    ev_schedule(conn->tx_ev);
 }
 
 /* Capatibility negotiation as per RFC 2842 */