Skip to content

srs_error_t SrsRtmpServer::handshake() The logic inside here is problematic. #1057

Closed
@zhenchengdezhichi

Description

srs_error_t SrsRtmpServer::handshake()
{
srs_error_t err = srs_success;

srs_assert(hs_bytes);

SrsComplexHandshake complex_hs;
if ((err = complex_hs.handshake_with_client(hs_bytes, io)) != srs_success) {
    if (srs_error_code(err) == ERROR_RTMP_TRY_SIMPLE_HS) {
        srs_freep(err);
        
        SrsSimpleHandshake simple_hs;
        if ((err = simple_hs.handshake_with_client(hs_bytes, io)) != srs_success) {
            return srs_error_wrap(err, "simple handshake");
        }
    }
    return srs_error_wrap(err, "complex handshake");
}

srs_freep(hs_bytes);

return err;

}

If I go for a simple handshake and it succeeds, will I still execute return srs_error_wrap(err, "complex handshake");? In that case, err will not be srs_success. Please confirm.

TRANS_BY_GPT3

Metadata

Assignees

Labels

BugIt might be a bug.TransByAITranslated by AI/GPT.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions