aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--net/dcsctp/public/dcsctp_socket.h3
-rw-r--r--net/dcsctp/socket/dcsctp_socket.cc4
-rw-r--r--net/dcsctp/socket/dcsctp_socket.h3
-rw-r--r--net/dcsctp/socket/dcsctp_socket_test.cc5
4 files changed, 14 insertions, 1 deletions
diff --git a/net/dcsctp/public/dcsctp_socket.h b/net/dcsctp/public/dcsctp_socket.h
index f340cd9ca0..1c2fb97f7a 100644
--- a/net/dcsctp/public/dcsctp_socket.h
+++ b/net/dcsctp/public/dcsctp_socket.h
@@ -296,6 +296,9 @@ class DcSctpSocketInterface {
// The options it was created with.
virtual const DcSctpOptions& options() const = 0;
+ // Update the options max_message_size.
+ virtual void SetMaxMessageSize(size_t max_message_size) = 0;
+
// Sends the message `message` using the provided send options.
// Sending a message is an asynchrous operation, and the `OnError` callback
// may be invoked to indicate any errors in sending the message.
diff --git a/net/dcsctp/socket/dcsctp_socket.cc b/net/dcsctp/socket/dcsctp_socket.cc
index b54ad80b9c..dd54317718 100644
--- a/net/dcsctp/socket/dcsctp_socket.cc
+++ b/net/dcsctp/socket/dcsctp_socket.cc
@@ -424,6 +424,10 @@ SocketState DcSctpSocket::state() const {
}
}
+void DcSctpSocket::SetMaxMessageSize(size_t max_message_size) {
+ options_.max_message_size = max_message_size;
+}
+
void DcSctpSocket::MaybeSendShutdownOnPacketReceived(const SctpPacket& packet) {
if (state_ == State::kShutdownSent) {
bool has_data_chunk =
diff --git a/net/dcsctp/socket/dcsctp_socket.h b/net/dcsctp/socket/dcsctp_socket.h
index 271e82e42e..24c0437b41 100644
--- a/net/dcsctp/socket/dcsctp_socket.h
+++ b/net/dcsctp/socket/dcsctp_socket.h
@@ -92,6 +92,7 @@ class DcSctpSocket : public DcSctpSocketInterface {
rtc::ArrayView<const StreamID> outgoing_streams) override;
SocketState state() const override;
const DcSctpOptions& options() const override { return options_; }
+ void SetMaxMessageSize(size_t max_message_size) override;
// Returns this socket's verification tag, or zero if not yet connected.
VerificationTag verification_tag() const {
@@ -244,7 +245,7 @@ class DcSctpSocket : public DcSctpSocketInterface {
const std::string log_prefix_;
const std::unique_ptr<PacketObserver> packet_observer_;
- const DcSctpOptions options_;
+ DcSctpOptions options_;
// Enqueues callbacks and dispatches them just before returning to the caller.
CallbackDeferrer callbacks_;
diff --git a/net/dcsctp/socket/dcsctp_socket_test.cc b/net/dcsctp/socket/dcsctp_socket_test.cc
index 1848448587..c542a9cd1a 100644
--- a/net/dcsctp/socket/dcsctp_socket_test.cc
+++ b/net/dcsctp/socket/dcsctp_socket_test.cc
@@ -1085,5 +1085,10 @@ TEST_F(DcSctpSocketTest, PassingHighWatermarkWillOnlyAcceptCumAckTsn) {
.Build());
}
+TEST_F(DcSctpSocketTest, SetMaxMessageSize) {
+ sock_a_.SetMaxMessageSize(42u);
+ EXPECT_EQ(sock_a_.options().max_message_size, 42u);
+}
+
} // namespace
} // namespace dcsctp