@@ -177,6 +177,20 @@ class Connection : public std::enable_shared_from_this<Connection> {
177177 const Connection::State& prev_state () const
178178 { return *prev_state_; }
179179
180+ uint64_t bytes_received () const
181+ { return bytes_rx_; }
182+
183+ uint64_t bytes_transmitted () const
184+ { return bytes_tx_; }
185+
186+ /* *
187+ * @brief Total number of bytes in read buffer
188+ *
189+ * @return bytes not yet read
190+ */
191+ size_t readq_size () const
192+ { return read_request.buffer .size (); }
193+
180194 /* *
181195 * @brief Total number of bytes in send queue
182196 *
@@ -193,32 +207,6 @@ class Connection : public std::enable_shared_from_this<Connection> {
193207 uint32_t sendq_remaining () const
194208 { return writeq.bytes_remaining (); }
195209
196- /*
197- Calculates and return bytes transmitted.
198- TODO: Not sure if this will suffice.
199- */
200- uint32_t bytes_transmitted () const
201- { return 0 ; }
202-
203- /*
204- Calculates and return bytes received.
205- TODO: Not sure if this will suffice.
206- */
207- uint32_t bytes_received () const
208- { return 0 ; }
209-
210- /*
211- Bytes queued for transmission.
212- TODO: Implement when retransmission is up and running.
213- */
214- // inline size_t send_queue_bytes() const {}
215-
216- /*
217- Bytes currently in receive buffer.
218- */
219- size_t read_queue_bytes () const
220- { return read_request.buffer .size (); }
221-
222210 /*
223211 Return the id (TUPLE) of the connection.
224212 */
@@ -477,6 +465,10 @@ class Connection : public std::enable_shared_from_this<Connection> {
477465 RtxTimeoutCallback on_rtx_timeout_;
478466 CloseCallback on_close_;
479467
468+ /* * Recv/Sent */
469+ uint64_t bytes_rx_;
470+ uint64_t bytes_tx_;
471+
480472 /* * State if connection is in TCP write queue or not. */
481473 bool queued_;
482474
0 commit comments