Added a couple of warnings back and removed the destructor for the log counter

This commit is contained in:
Staz M
2021-01-04 17:29:22 -05:00
parent f41baa5c51
commit adb733d19a
4 changed files with 15 additions and 19 deletions

View File

@ -172,6 +172,7 @@ void DataChannel::open(shared_ptr<SctpTransport> transport) {
} }
void DataChannel::processOpenMessage(message_ptr) { void DataChannel::processOpenMessage(message_ptr) {
PLOG_DEBUG << "Received an open message for a user-negotiated DataChannel, ignoring";
COUNTER_USERNEG_OPEN_MESSAGE++; COUNTER_USERNEG_OPEN_MESSAGE++;
} }

View File

@ -29,7 +29,6 @@ using std::shared_ptr;
using std::to_integer; using std::to_integer;
using std::to_string; using std::to_string;
static rtc::LogCounter COUNTER_MEDIA_SENT_EARLY(plog::warning, "Number of RTP packets sent before keys have been derived");
static rtc::LogCounter COUNTER_MEDIA_TRUNCATED(plog::warning, "Number of truncated SRT(C)P packets received"); static rtc::LogCounter COUNTER_MEDIA_TRUNCATED(plog::warning, "Number of truncated SRT(C)P packets received");
static rtc::LogCounter COUNTER_UNKNOWN_PACKET_TYPE(plog::warning, "Number of RTP packets received with an unknown packet type"); static rtc::LogCounter COUNTER_UNKNOWN_PACKET_TYPE(plog::warning, "Number of RTP packets received with an unknown packet type");
static rtc::LogCounter COUNTER_SRTCP_REPLAY(plog::warning, "Number of SRTCP replay packets received"); static rtc::LogCounter COUNTER_SRTCP_REPLAY(plog::warning, "Number of SRTCP replay packets received");
@ -91,7 +90,7 @@ bool DtlsSrtpTransport::sendMedia(message_ptr message) {
return false; return false;
if (!mInitDone) { if (!mInitDone) {
COUNTER_MEDIA_SENT_EARLY++; PLOG_ERROR << "SRTP media sent before keys are derived";
return false; return false;
} }
@ -191,13 +190,15 @@ void DtlsSrtpTransport::incoming(message_ptr message) {
if (value2 >= 64 && value2 <= 95) { // Range 64-95 (inclusive) MUST be RTCP if (value2 >= 64 && value2 <= 95) { // Range 64-95 (inclusive) MUST be RTCP
PLOG_VERBOSE << "Incoming SRTCP packet, size=" << size; PLOG_VERBOSE << "Incoming SRTCP packet, size=" << size;
if (srtp_err_status_t err = srtp_unprotect_rtcp(mSrtpIn, message->data(), &size)) { if (srtp_err_status_t err = srtp_unprotect_rtcp(mSrtpIn, message->data(), &size)) {
if (err == srtp_err_status_replay_fail) if (err == srtp_err_status_replay_fail) {
COUNTER_SRTCP_REPLAY++; PLOG_VERBOSE << "Incoming SRTCP packet is a replay";
else if (err == srtp_err_status_auth_fail) COUNTER_SRTCP_REPLAY++;
}else if (err == srtp_err_status_auth_fail) {
PLOG_VERBOSE << "Incoming SRTCP packet failed authentication check";
COUNTER_SRTCP_AUTH_FAIL++; COUNTER_SRTCP_AUTH_FAIL++;
else { }else {
COUNTER_SRTCP_FAIL++;
PLOG_VERBOSE << "SRTCP unprotect error, status=" << err; PLOG_VERBOSE << "SRTCP unprotect error, status=" << err;
COUNTER_SRTCP_FAIL++;
} }
return; return;
@ -209,13 +210,15 @@ void DtlsSrtpTransport::incoming(message_ptr message) {
} else { } else {
PLOG_VERBOSE << "Incoming SRTP packet, size=" << size; PLOG_VERBOSE << "Incoming SRTP packet, size=" << size;
if (srtp_err_status_t err = srtp_unprotect(mSrtpIn, message->data(), &size)) { if (srtp_err_status_t err = srtp_unprotect(mSrtpIn, message->data(), &size)) {
if (err == srtp_err_status_replay_fail) if (err == srtp_err_status_replay_fail) {
PLOG_VERBOSE << "Incoming SRTP packet is a replay";
COUNTER_SRTP_REPLAY++; COUNTER_SRTP_REPLAY++;
else if (err == srtp_err_status_auth_fail) } else if (err == srtp_err_status_auth_fail) {
PLOG_VERBOSE << "Incoming SRTP packet failed authentication check";
COUNTER_SRTP_AUTH_FAIL++; COUNTER_SRTP_AUTH_FAIL++;
else { } else {
COUNTER_SRTP_FAIL++;
PLOG_VERBOSE << "SRTP unprotect error, status=" << err; PLOG_VERBOSE << "SRTP unprotect error, status=" << err;
COUNTER_SRTP_FAIL++;
} }
return; return;
} }

View File

@ -38,9 +38,3 @@ rtc::LogCounter& rtc::LogCounter::operator++(int) {
} }
return *this; return *this;
} }
rtc::LogCounter::~LogCounter() {
if (future) {
future->wait();
}
}

View File

@ -36,8 +36,6 @@ public:
LogCounter(plog::Severity severity, const std::string& text, std::chrono::seconds duration=std::chrono::seconds(1)); LogCounter(plog::Severity severity, const std::string& text, std::chrono::seconds duration=std::chrono::seconds(1));
~LogCounter();
LogCounter& operator++(int); LogCounter& operator++(int);
}; };
} }