diff --git a/include/re_tcp.h b/include/re_tcp.h index 2392641..33749d0 100644 --- a/include/re_tcp.h +++ b/include/re_tcp.h @@ -73,6 +73,7 @@ void tcp_conn_txqsz_set(struct tcp_conn *tc, size_t txqsz); int tcp_conn_local_get(const struct tcp_conn *tc, struct sa *local); int tcp_conn_peer_get(const struct tcp_conn *tc, struct sa *peer); int tcp_conn_fd(const struct tcp_conn *tc); +size_t tcp_conn_txqsz(const struct tcp_conn *tc); /* High-level API */ diff --git a/src/tcp/tcp.c b/src/tcp/tcp.c index 961b225..f2a5549 100644 --- a/src/tcp/tcp.c +++ b/src/tcp/tcp.c @@ -1324,6 +1324,19 @@ int tcp_conn_fd(const struct tcp_conn *tc) } +/** + * Get the current length of the transmit queue on a TCP Connection + * + * @param tc TCP-Connection + * + * @return Current transmit queue length, or 0 if errors + */ +size_t tcp_conn_txqsz(const struct tcp_conn *tc) +{ + return tc ? tc->txqsz : 0; +} + + static bool sort_handler(struct le *le1, struct le *le2, void *arg) { struct tcp_helper *th1 = le1->data, *th2 = le2->data;