mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
Dispose session when DTLS alert
This commit is contained in:
parent
86a80396de
commit
dd7587c497
7 changed files with 92 additions and 37 deletions
|
@ -118,6 +118,11 @@ srs_error_t SrsSecurityTransport::on_dtls(char* data, int nb_data)
|
|||
return dtls_->on_dtls(data, nb_data);
|
||||
}
|
||||
|
||||
srs_error_t SrsSecurityTransport::on_dtls_alert(std::string type, std::string desc)
|
||||
{
|
||||
return session_->on_dtls_alert(type, desc);
|
||||
}
|
||||
|
||||
srs_error_t SrsSecurityTransport::on_dtls_handshake_done()
|
||||
{
|
||||
srs_error_t err = srs_success;
|
||||
|
@ -237,6 +242,11 @@ srs_error_t SrsPlaintextTransport::on_dtls(char* data, int nb_data)
|
|||
return srs_success;
|
||||
}
|
||||
|
||||
srs_error_t SrsPlaintextTransport::on_dtls_alert(std::string type, std::string desc)
|
||||
{
|
||||
return srs_success;
|
||||
}
|
||||
|
||||
srs_error_t SrsPlaintextTransport::on_dtls_handshake_done()
|
||||
{
|
||||
srs_trace("RTC: DTLS handshake done.");
|
||||
|
@ -2112,6 +2122,26 @@ srs_error_t SrsRtcConnection::on_connection_established()
|
|||
return err;
|
||||
}
|
||||
|
||||
srs_error_t SrsRtcConnection::on_dtls_alert(std::string type, std::string desc)
|
||||
{
|
||||
srs_error_t err = srs_success;
|
||||
|
||||
SrsRtcConnection* session = this;
|
||||
|
||||
// CN(Close Notify) is sent when client close the PeerConnection.
|
||||
if (type == "warning" && desc == "CN") {
|
||||
SrsContextRestore(_srs_context->get_id());
|
||||
session->switch_to_context();
|
||||
|
||||
string username = session->username();
|
||||
srs_trace("RTC: session DTLS alert, username=%s, summary: %s", username.c_str(), session->stat_->summary().c_str());
|
||||
|
||||
server_->dispose(session);
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
srs_error_t SrsRtcConnection::start_play(string stream_uri)
|
||||
{
|
||||
srs_error_t err = srs_success;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue