-
Notifications
You must be signed in to change notification settings - Fork 851
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implemented and exposed rejection reason #720
Conversation
What I'm not sure about, after time, is that whether this "peer reported" flag is really required. This complicates the API usage for the user, while for the user it usually doesn't matter if the rejection was initiated by the listener or the caller, moreover, usually it will be the listener that rejected the connection, while this can only be reported on the caller. I'm thinking of removing this bit completely as unnecessary. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider renaming the SRT_REJ_STRICTENC
, given that strict encryption is also to be renamed (#755).
Maybe SRT_REJ_BADENCRYPT
?
Usage example:
|
I think |
…dev-add-reject-reason
The rejection reason has been implemented. As a demonstration, also reported by
srt-test-live
.Internal changes: the codes for
m_iReqType
in the handshake contain error values that contain reject reason, which occupy all values above 1000 (as previously erroneous values). Backward compatibility assignments to codes 1002 and 1004 asSRT_REJ_PEER
andSRT_REJ_ROGUE
respectively, however when getting the rejection reason from the peer in older version than this PR will get alwaysSRT_REJ_PEER
code, only newer version will report correct detailed code.API changes: new API entries:
srt_getrejectreason(SRTSOCKET)
: call this function immediately after the failure has reported the error code asSRT_ECONNREJ
. This gets the reject reason as a numeric value, however potentially with theSRT_REJ_PEERREP
bit set, which means that this code has been reported by peer, not by agent.srt_rejectreason_str(enum SRT_REJECT_REASON)
: will return the message code, disregarding theSRT_REJ_PEERREP
bit - this one must be checked separately (this is a result from the simplicity of the implementation, where the code is mapped to a message in an array).Fixes #684