Revert "Propagate socket write errors for DtlsTransport"

There is a suspicion that it causes OpenSSL errors:
  [openssl_stream_adapter.cc(961)]
       OpenSSLStreamAdapter::Error(SSL_write, 5, 0)

This commit does change the interaction with OpenSSL as propagating the
socket write errors as SR_BLOCK results in calling BIO_set_retry_write,
as part of current implementation of OpenSSLStreamAdapter.

Testing this regression has proven to be hard to do manually.

This reverts commit edfaaef086ccff2dbff29d64c9a8d9f633637c57.

Bug: webrtc:12943
Change-Id: Ib6767bd4af68c59fd3b7cb051341876f175bb921
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/230420
Reviewed-by: Tommi <tommi@webrtc.org>
Commit-Queue: Victor Boivie <boivie@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#34875}
This commit is contained in:
Victor Boivie
2021-08-27 16:11:48 +02:00
committed by WebRTC LUCI CQ
parent 260400d37f
commit 10721227e4
3 changed files with 6 additions and 36 deletions

View File

@ -93,17 +93,12 @@ rtc::StreamResult StreamInterfaceChannel::Write(const void* data,
size_t* written,
int* error) {
RTC_DCHECK_RUN_ON(&sequence_checker_);
// Always succeeds, since this is an unreliable transport anyway.
// TODO(zhihuang): Should this block if ice_transport_'s temporarily
// unwritable?
rtc::PacketOptions packet_options;
int sent = ice_transport_->SendPacket(static_cast<const char*>(data),
data_len, packet_options);
if (sent < 0) {
if (written) {
*written = 0;
}
return rtc::IsBlockingError(ice_transport_->GetError()) ? rtc::SR_BLOCK
: rtc::SR_ERROR;
}
ice_transport_->SendPacket(static_cast<const char*>(data), data_len,
packet_options);
if (written) {
*written = data_len;
}

View File

@ -421,16 +421,6 @@ TEST_F(DtlsTransportTest, TestTransferDtls) {
TestTransfer(1000, 100, /*srtp=*/false);
}
// Connect with DTLS, and fail to write, to ensure errors are propagated.
TEST_F(DtlsTransportTest, TestWriteFailsOverDtls) {
PrepareDtls(rtc::KT_DEFAULT);
ASSERT_TRUE(Connect());
client1_.fake_ice_transport()->SetError(EAGAIN);
int res = client1_.dtls_transport()->SendPacket("hello", 5,
rtc::PacketOptions(), 0);
EXPECT_EQ(res, -1);
}
// Connect with DTLS, combine multiple DTLS records into one packet.
// Our DTLS implementation doesn't do this, but other implementations may;
// see https://tools.ietf.org/html/rfc6347#section-4.1.1.

View File

@ -302,10 +302,6 @@ class FakeIceTransport : public IceTransportInternal {
return -1;
}
if (error_ != 0) {
return -1;
}
send_packet_.AppendData(data, len);
if (!combine_outgoing_packets_ || send_packet_.size() > len) {
rtc::CopyOnWriteBuffer packet(std::move(send_packet_));
@ -342,17 +338,7 @@ class FakeIceTransport : public IceTransportInternal {
}
}
// Sets the error that is returned by `GetError`. If an error is set (i.e.
// non-zero), `SendPacket` will return -1.
void SetError(int error) {
RTC_DCHECK_RUN_ON(network_thread_);
error_ = error;
}
int GetError() override {
RTC_DCHECK_RUN_ON(network_thread_);
return error_;
}
int GetError() override { return 0; }
rtc::CopyOnWriteBuffer last_sent_packet() {
RTC_DCHECK_RUN_ON(network_thread_);
@ -435,7 +421,6 @@ class FakeIceTransport : public IceTransportInternal {
rtc::CopyOnWriteBuffer last_sent_packet_ RTC_GUARDED_BY(network_thread_);
rtc::Thread* const network_thread_;
webrtc::ScopedTaskSafetyDetached task_safety_;
int error_ RTC_GUARDED_BY(network_thread_) = 0;
};
class FakeIceTransportWrapper : public webrtc::IceTransportInterface {