Return an error when datachannel closes due to network error

This is the start of generating compliant errors, including diagnostics,
when datachannels close because of errors.

Bug: chromium:1030631
Change-Id: I39aa41728efb25bca6193a782db4cbdaad8e0dc1
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/161304
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#30034}
This commit is contained in:
Harald Alvestrand
2019-12-08 05:55:43 +01:00
committed by Commit Bot
parent 33f9d2b383
commit dfbfb46062
8 changed files with 130 additions and 25 deletions

View File

@ -20,6 +20,7 @@
#include <string>
#include "absl/types/optional.h"
#include "api/rtc_error.h"
#include "rtc_base/checks.h"
#include "rtc_base/copy_on_write_buffer.h"
#include "rtc_base/ref_count.h"
@ -154,6 +155,10 @@ class RTC_EXPORT DataChannelInterface : public rtc::RefCountInterface {
// determined, and until then this will return -1.
virtual int id() const = 0;
virtual DataState state() const = 0;
// When state is kClosed, and the DataChannel was not closed using
// the closing procedure, returns the error information about the closing.
// The default implementation returns "no error".
virtual RTCError error() const { return RTCError(); }
virtual uint32_t messages_sent() const = 0;
virtual uint64_t bytes_sent() const = 0;
virtual uint32_t messages_received() const = 0;