Skip to content

Commit

Permalink
Add lsquic_engine_get_conns_count api to return current engine's conn…
Browse files Browse the repository at this point in the history
…ection count (#517)

Co-authored-by: Alex Pokotilo <[email protected]>
  • Loading branch information
alexpokotilo and Alex Pokotilo authored Nov 19, 2024
1 parent 232da0e commit b0bd690
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
6 changes: 6 additions & 0 deletions include/lsquic.h
Original file line number Diff line number Diff line change
Expand Up @@ -1438,6 +1438,12 @@ lsquic_engine_packet_in (lsquic_engine_t *,
const struct sockaddr *sa_local, const struct sockaddr *sa_peer,
void *peer_ctx, int ecn);

/**
* Returns current number of connections processed by the engine. Both mini and full connections included
*/
unsigned
lsquic_engine_get_conns_count (lsquic_engine_t *engine);

/**
* Process tickable connections. This function must be called often enough so
* that packets and connections do not expire.
Expand Down
5 changes: 5 additions & 0 deletions src/liblsquic/lsquic_engine.c
Original file line number Diff line number Diff line change
Expand Up @@ -2213,6 +2213,11 @@ drop_all_mini_conns (lsquic_engine_t *engine)
cub_flush(&cub);
}

unsigned
lsquic_engine_get_conns_count (lsquic_engine_t *engine)
{
return engine->n_conns;
}

void
lsquic_engine_process_conns (lsquic_engine_t *engine)
Expand Down

0 comments on commit b0bd690

Please sign in to comment.