Skip to content

Commit

Permalink
DTLS: Use bio callback to get fragment packet. v5.0.156, v6.0.47 (oss…
Browse files Browse the repository at this point in the history
…rs#3565)

1. The MTU is effective, with the certificate being split into two DTLS records to comply with the limit.
2. 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.
3. An alternative callback is available for using BIO_new with BIO_s_mem.
4. Improvements to the MTU setting were made, including adding the DTLS_set_link_mtu function and removing the SSL_set_max_send_fragment function.
5. The handshake process was refined, calling SSL_do_handshake only after ICE completion, and using SSL_read to handle handshake messages.
6. The session close code was improved to enable immediate closure upon receiving an SSL CloseNotify or fatal message.

------

Co-authored-by: chundonglinlin <[email protected]>
  • Loading branch information
2 people authored and johzzy committed Jun 25, 2023
1 parent 02386cd commit bb3558d
Show file tree
Hide file tree
Showing 3 changed files with 208 additions and 229 deletions.
3 changes: 2 additions & 1 deletion trunk/src/app/srs_app_rtc_conn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3860,7 +3860,8 @@ 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();

Expand Down
Loading

0 comments on commit bb3558d

Please sign in to comment.