summaryrefslogtreecommitdiff
path: root/proto/bgp/bgp.c
diff options
context:
space:
mode:
authorMaria Matejka <mq@ucw.cz>2023-02-24 09:13:35 +0100
committerMaria Matejka <mq@ucw.cz>2023-04-04 17:00:59 +0200
commit571c4f69bfbcf437d848b332bb2f4995fea2347d (patch)
tree01af432e1fa4a61be6793be90c59bf4223de6539 /proto/bgp/bgp.c
parentd9f0f4af7dc49c22232cc3be5e40866fc7d5dda7 (diff)
More efficient IO loop event execution to avoid long loops
If there are lots of loops in a single thread and only some of the loops are actually active, the other loops are now kept aside and not checked until they actually get some timers, events or active sockets. This should help with extreme loads like 100k tables and protocols. Also ping and loop pickup mechanism was allowing subtle race conditions. Now properly handling collisions between loop ping and pickup.
Diffstat (limited to 'proto/bgp/bgp.c')
-rw-r--r--proto/bgp/bgp.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/proto/bgp/bgp.c b/proto/bgp/bgp.c
index cca1283c..122b0c22 100644
--- a/proto/bgp/bgp.c
+++ b/proto/bgp/bgp.c
@@ -217,6 +217,8 @@ bgp_open(struct bgp_proto *p)
req->port = p->cf->local_port;
req->flags = p->cf->free_bind ? SKF_FREEBIND : 0;
+ BGP_TRACE(D_EVENTS, "Requesting listen socket at %I%J port %u", req->addr, req->iface, req->port);
+
add_tail(&bgp_listen_pending, &req->n);
ev_schedule(&bgp_listen_event);
}
@@ -243,7 +245,9 @@ bgp_listen_create(void *_ UNUSED)
break;
/* Not found any */
- if (!NODE_VALID(bs))
+ if (NODE_VALID(bs))
+ BGP_TRACE(D_EVENTS, "Found a listening socket: %p", bs);
+ else
{
sock *sk = sk_new(proto_pool);
sk->type = SK_TCP_PASSIVE;
@@ -275,6 +279,8 @@ bgp_listen_create(void *_ UNUSED)
init_list(&bs->requests);
add_tail(&bgp_sockets, &bs->n);
+
+ BGP_TRACE(D_EVENTS, "Created new listening socket: %p", bs);
}
add_tail(&bs->requests, &req->n);