aboutsummaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorVictor Boivie <boivie@webrtc.org>2022-05-13 15:31:14 +0200
committerWebRTC LUCI CQ <webrtc-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-07-01 08:12:44 +0000
commit5b2556e9cdb3156d5c0b4a196ecf997107d22582 (patch)
tree9da31b24ffeca4aebb56bc676f99ba7cafbdebd6 /net
parent11174e7058f73cd763f4bc614cbfc057d5a0c1db (diff)
downloadwebrtc-5b2556e9cdb3156d5c0b4a196ecf997107d22582.tar.gz
dcsctp: Add metric for using message interleaving
There was also some refactoring to create the TCB at the same time, to ensure the metric is always set. Bug: webrtc:13052, webrtc:5696 Change-Id: I5557ad5f0fc4a0520de1eaaafa15459b3200c4f5 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/262259 Reviewed-by: Harald Alvestrand <hta@webrtc.org> Commit-Queue: Victor Boivie <boivie@webrtc.org> Cr-Commit-Position: refs/heads/main@{#37388}
Diffstat (limited to 'net')
-rw-r--r--net/dcsctp/public/dcsctp_socket.h4
-rw-r--r--net/dcsctp/socket/dcsctp_socket.cc1
-rw-r--r--net/dcsctp/socket/dcsctp_socket_test.cc16
3 files changed, 21 insertions, 0 deletions
diff --git a/net/dcsctp/public/dcsctp_socket.h b/net/dcsctp/public/dcsctp_socket.h
index 0a65dae1d4..770c6746f9 100644
--- a/net/dcsctp/public/dcsctp_socket.h
+++ b/net/dcsctp/public/dcsctp_socket.h
@@ -235,6 +235,10 @@ struct Metrics {
// explicitly signalled during the connection establishment, heuristics is
// used to analyze e.g. the state cookie in the INIT-ACK chunk.
SctpImplementation peer_implementation = SctpImplementation::kUnknown;
+
+ // Indicates if RFC8260 User Message Interleaving has been negotiated by both
+ // peers.
+ bool uses_message_interleaving = false;
};
// Callbacks that the DcSctpSocket will call synchronously to the owning
diff --git a/net/dcsctp/socket/dcsctp_socket.cc b/net/dcsctp/socket/dcsctp_socket.cc
index 421b3bfea3..9287b869ac 100644
--- a/net/dcsctp/socket/dcsctp_socket.cc
+++ b/net/dcsctp/socket/dcsctp_socket.cc
@@ -314,6 +314,7 @@ void DcSctpSocket::CreateTransmissionControlBlock(
TSN peer_initial_tsn,
size_t a_rwnd,
TieTag tie_tag) {
+ metrics_.uses_message_interleaving = capabilities.message_interleaving;
tcb_ = std::make_unique<TransmissionControlBlock>(
timer_manager_, log_prefix_, options_, capabilities, callbacks_,
send_queue_, my_verification_tag, my_initial_tsn, peer_verification_tag,
diff --git a/net/dcsctp/socket/dcsctp_socket_test.cc b/net/dcsctp/socket/dcsctp_socket_test.cc
index e70378ffd3..f4b0b2c89f 100644
--- a/net/dcsctp/socket/dcsctp_socket_test.cc
+++ b/net/dcsctp/socket/dcsctp_socket_test.cc
@@ -1892,6 +1892,22 @@ TEST(DcSctpSocketTest, InitialMetricsAreUnset) {
EXPECT_FALSE(a.socket.GetMetrics().has_value());
}
+TEST(DcSctpSocketTest, MessageInterleavingMetricsAreSet) {
+ std::vector<std::pair<bool, bool>> combinations = {
+ {false, false}, {false, true}, {true, false}, {true, true}};
+ for (const auto& [a_enable, z_enable] : combinations) {
+ DcSctpOptions a_options = {.enable_message_interleaving = a_enable};
+ DcSctpOptions z_options = {.enable_message_interleaving = z_enable};
+
+ SocketUnderTest a("A", a_options);
+ SocketUnderTest z("Z", z_options);
+ ConnectSockets(a, z);
+
+ EXPECT_EQ(a.socket.GetMetrics()->uses_message_interleaving,
+ a_enable && z_enable);
+ }
+}
+
TEST(DcSctpSocketTest, RxAndTxPacketMetricsIncrease) {
SocketUnderTest a("A");
SocketUnderTest z("Z");