Skip to content

Commit

Permalink
DTLS: Use bio callback to get fragment packet. v5.0.156, v6.0.47 (#3565)
Browse files Browse the repository at this point in the history
1. The MTU is effective, with the certificate being split into two DTLS records to comply with the limit.
1. The issue occurs when using BIO_get_mem_data, which retrieves all DTLS packets in a single call, even though each is smaller than the MTU.
1. An alternative callback is available for using BIO_new with BIO_s_mem.
1. Improvements to the MTU setting were made, including adding the DTLS_set_link_mtu function and removing the SSL_set_max_send_fragment function.
1. The handshake process was refined, calling SSL_do_handshake only after ICE completion, and using SSL_read to handle handshake messages.
1. The session close code was improved to enable immediate closure upon receiving an SSL CloseNotify or fatal message.

------

Co-authored-by: chundonglinlin <chundonglinlin@163.com>
  • Loading branch information
winlinvip and chundonglinlin committed Jun 5, 2023
1 parent 27f9db9 commit 2001f36
Show file tree
Hide file tree
Showing 6 changed files with 156 additions and 263 deletions.
2 changes: 2 additions & 0 deletions trunk/doc/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ The changelog for SRS.

## SRS 6.0 Changelog

* v6.0, 2023-06-05, Merge [#3565](https://github.com/ossrs/srs/pull/3565): DTLS: Use bio callback to get fragment packet. v6.0.47 (#3565)
* v6.0, 2023-05-29, Merge [#3513](https://github.com/ossrs/srs/pull/3513): SSL: Fix SSL_get_error get the error of other coroutine. v6.0.46 (#3513)
* v6.0, 2023-05-14, Merge [#3534](https://github.com/ossrs/srs/pull/3534): Replace sprintf with snprintf to eliminate compile warnings. v6.0.45 (#3534)
* v6.0, 2023-05-13, Merge [#3541](https://github.com/ossrs/srs/pull/3541): asan: Fix memory leak in asan by releasing global IPs when run_directly_or_daemon fails. v6.0.44 (#3541)
Expand Down Expand Up @@ -60,6 +61,7 @@ The changelog for SRS.

## SRS 5.0 Changelog

* v5.0, 2023-06-05, Merge [#3565](https://github.com/ossrs/srs/pull/3565): DTLS: Use bio callback to get fragment packet. v5.0.156 (#3565)
* v5.0, 2023-05-29, Merge [#3513](https://github.com/ossrs/srs/pull/3513): SSL: Fix SSL_get_error get the error of other coroutine. v5.0.155 (#3513)
* v5.0, 2023-05-13, Merge [#3541](https://github.com/ossrs/srs/pull/3541): asan: Fix memory leak in asan by releasing global IPs when run_directly_or_daemon fails. v5.0.154 (#3541)
* v5.0, 2023-05-12, Merge [#3539](https://github.com/ossrs/srs/pull/3539): WHIP: Improve HTTP DELETE for notifying server unpublish event. v5.0.153 (#3539)
Expand Down
5 changes: 3 additions & 2 deletions trunk/src/app/srs_app_rtc_conn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2240,11 +2240,12 @@ srs_error_t SrsRtcConnection::on_dtls_alert(std::string type, std::string desc)
srs_error_t err = srs_success;

// CN(Close Notify) is sent when client close the PeerConnection.
if (type == "warning" && desc == "CN") {
// fatal, IP(Illegal Parameter) is sent when DTLS failed.
if (type == "fatal" || (type == "warning" && desc == "CN")) {
SrsContextRestore(_srs_context->get_id());
switch_to_context();

srs_trace("RTC: session destroy by DTLS alert, username=%s", username_.c_str());
srs_trace("RTC: session destroy by DTLS alert(%s %s), username=%s", type.c_str(), desc.c_str(), username_.c_str());
_srs_rtc_manager->remove(this);
}

Expand Down
Loading

0 comments on commit 2001f36

Please sign in to comment.