diff --git a/p2p/dtls/dtls_transport.cc b/p2p/dtls/dtls_transport.cc index 1cba867ace..6470fc7d0b 100644 --- a/p2p/dtls/dtls_transport.cc +++ b/p2p/dtls/dtls_transport.cc @@ -591,7 +591,7 @@ int DtlsTransportInternalImpl::SendPacket( // an encrypted packet, rather than calling the // StreamInterfaceChannel::Write function. Such change would remove the // need of the next_packet_options_. - StreamResult result = dtls_->WriteAll( + StreamResult result = dtls_->Write( MakeArrayView(reinterpret_cast(data), size), written, error); if (result != SR_SUCCESS) { @@ -600,6 +600,10 @@ int DtlsTransportInternalImpl::SendPacket( downward_->ClearNextPacketOptions(); return -1; } + // For DTLS, a SSL_Write operation will either send the entire data in a + // single record, or fail the entire send. See for example the + // documentation on SSL_write in boringssl/src/include/openssl/ssl.h + RTC_CHECK(written == size); return static_cast(size); } case DtlsTransportState::kFailed: diff --git a/rtc_base/stream.cc b/rtc_base/stream.cc index 973178121d..e30b33b8be 100644 --- a/rtc_base/stream.cc +++ b/rtc_base/stream.cc @@ -9,10 +9,7 @@ */ #include "rtc_base/stream.h" -#include -#include -#include "api/array_view.h" namespace webrtc { @@ -20,23 +17,6 @@ namespace webrtc { // StreamInterface /////////////////////////////////////////////////////////////////////////////// -StreamResult StreamInterface::WriteAll(ArrayView data, - size_t& written, - int& error) { - StreamResult result = SR_SUCCESS; - size_t total_written = 0, current_written; - while (total_written < data.size()) { - ArrayView this_slice = - data.subview(total_written, data.size() - total_written); - result = Write(this_slice, current_written, error); - if (result != SR_SUCCESS) - break; - total_written += current_written; - } - written = total_written; - return result; -} - bool StreamInterface::Flush() { return false; } diff --git a/rtc_base/stream.h b/rtc_base/stream.h index c6690b5082..a8191567d5 100644 --- a/rtc_base/stream.h +++ b/rtc_base/stream.h @@ -103,21 +103,6 @@ class RTC_EXPORT StreamInterface { // Return true if flush is successful. virtual bool Flush(); - // - // CONVENIENCE METHODS - // - // These methods are implemented in terms of other methods, for convenience. - // - - // WriteAll is a helper function which repeatedly calls Write until all the - // data is written, or something other than SR_SUCCESS is returned. Note that - // unlike Write, the argument 'written' is always set, and may be non-zero - // on results other than SR_SUCCESS. The remaining arguments have the - // same semantics as Write. - StreamResult WriteAll(ArrayView data, - size_t& written, - int& error); - protected: StreamInterface();