summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaria Jan Matejka <mq@jmq.cz>2019-06-11 09:35:25 +0000
committerMaria Matejka <mq@ucw.cz>2019-07-01 09:05:50 +0200
commit9dac814ee89fe41856923a532c87ffd14dbc0f79 (patch)
tree87128a8c5f8001836b54094a2281f4eb1970236a
parentbb57d9171f2b4567f54169c8864953c4e5e18025 (diff)
BGP: split tx explicitly
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.
-rw-r--r--proto/bgp/packets.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/proto/bgp/packets.c b/proto/bgp/packets.c
index c7cc1d01..01a23d5a 100644
--- a/proto/bgp/packets.c
+++ b/proto/bgp/packets.c
@@ -2789,15 +2789,18 @@ bgp_schedule_packet(struct bgp_conn *conn, struct bgp_channel *c, int type)
if ((conn->sk->tpos == conn->sk->tbuf) && !ev_active(conn->tx_ev))
ev_schedule(conn->tx_ev);
}
-
void
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
@@ -2806,8 +2809,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);
}