From f11d344d4dec84950f09a36de965c0b697f0c1fe Mon Sep 17 00:00:00 2001 From: Adam Dunkels Date: Mon, 31 Oct 2016 22:11:34 +0100 Subject: [PATCH] Add a tcp_socket_queuelen() function that returns the length of the current TCP output queue --- core/net/ip/tcp-socket.c | 6 ++++++ core/net/ip/tcp-socket.h | 12 ++++++++++++ 2 files changed, 18 insertions(+) diff --git a/core/net/ip/tcp-socket.c b/core/net/ip/tcp-socket.c index d697ccdd9..cd26634a1 100644 --- a/core/net/ip/tcp-socket.c +++ b/core/net/ip/tcp-socket.c @@ -399,3 +399,9 @@ tcp_socket_max_sendlen(struct tcp_socket *s) return s->output_data_maxlen - s->output_data_len; } /*---------------------------------------------------------------------------*/ +int +tcp_socket_queuelen(struct tcp_socket *s) +{ + return s->output_data_len; +} +/*---------------------------------------------------------------------------*/ diff --git a/core/net/ip/tcp-socket.h b/core/net/ip/tcp-socket.h index 34cb0d6b7..dd7b5c793 100644 --- a/core/net/ip/tcp-socket.h +++ b/core/net/ip/tcp-socket.h @@ -284,4 +284,16 @@ int tcp_socket_unregister(struct tcp_socket *s); */ int tcp_socket_max_sendlen(struct tcp_socket *s); +/** + * \brief The number of bytes waiting to be sent + * \param s A pointer to a TCP socket + * \return The number of bytes that have not yet been acknowledged by the receiver. + * + * This function queries the TCP socket and returns the + * number of bytes that are currently not yet known to + * have been successfully received by the receiver. + * + */ +int tcp_socket_queuelen(struct tcp_socket *s); + #endif /* TCP_SOCKET_H */