Remove MessageHandler[AutoCleanup] dependency from StreamInterface.

This includes relying on related types such as MessageData and
PostEvent functionality inside the StreamInterface itself.

This affects mostly tests but OpenSSLStreamAdapter
requires special attention.

Bug: webrtc:11988
Change-Id: Ib5c895f1bdf77bb49e3162bd49718f8a98812d91
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/185505
Commit-Queue: Tommi <tommi@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32290}
This commit is contained in:
Tomas Gunnarsson
2020-10-02 12:54:10 +02:00
committed by Commit Bot
parent b33a7186e6
commit eb79dd9ffd
9 changed files with 86 additions and 67 deletions

View File

@ -26,6 +26,8 @@
#include "rtc_base/ssl_stream_adapter.h"
#include "rtc_base/stream.h"
#include "rtc_base/system/rtc_export.h"
#include "rtc_base/task_utils/pending_task_safety_flag.h"
#include "rtc_base/task_utils/repeating_task.h"
namespace rtc {
@ -145,7 +147,8 @@ class OpenSSLStreamAdapter final : public SSLStreamAdapter {
SSL_CLOSED // Clean close
};
enum { MSG_TIMEOUT = MSG_MAX + 1 };
void PostEvent(int events, int err);
void SetTimeout(int delay_ms);
// The following three methods return 0 on success and a negative
// error code on failure. The error code may be from OpenSSL or -1
@ -169,9 +172,6 @@ class OpenSSLStreamAdapter final : public SSLStreamAdapter {
void Error(const char* context, int err, uint8_t alert, bool signal);
void Cleanup(uint8_t alert);
// Override MessageHandler
void OnMessage(Message* msg) override;
// Flush the input buffers by reading left bytes (for DTLS)
void FlushInput(unsigned int left);
@ -192,6 +192,10 @@ class OpenSSLStreamAdapter final : public SSLStreamAdapter {
!peer_certificate_digest_value_.empty();
}
rtc::Thread* const owner_;
webrtc::ScopedTaskSafety task_safety_;
webrtc::RepeatingTaskHandle timeout_task_;
SSLState state_;
SSLRole role_;
int ssl_error_code_; // valid when state_ == SSL_ERROR or SSL_CLOSED