-
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
[core] Fixed RCV buffer initialization in Rendezvous. #2772
Merged
maxsharabayko
merged 1 commit into
Haivision:master
from
maxsharabayko:hotfix/rendezvous
Aug 7, 2023
Merged
[core] Fixed RCV buffer initialization in Rendezvous. #2772
maxsharabayko
merged 1 commit into
Haivision:master
from
maxsharabayko:hotfix/rendezvous
Aug 7, 2023
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
maxsharabayko
added
Type: Bug
Indicates an unexpected problem or unintended behavior
[core]
Area: Changes in SRT library core
labels
Aug 4, 2023
Additional changes suggested by @ethouris diff --git a/srtcore/common.cpp b/srtcore/common.cpp
index b621c802..a194dd75 100644
--- a/srtcore/common.cpp
+++ b/srtcore/common.cpp
@@ -525,6 +525,37 @@ std::string MemberStatusStr(SRT_MEMBERSTATUS s)
}
#endif
+std::string RejectReasonStr(int r)
+{
+ static const std::string reasons[SRT_REJ_E_SIZE] = {
+ "UNKNOWN"
+ ,"SYSTEM"
+ ,"PEER"
+ ,"RESOURCE"
+ ,"ROGUE"
+ ,"BACKLOG"
+ ,"IPE"
+ ,"CLOSE"
+ ,"VERSION"
+ ,"RDVCOOKIE"
+ ,"BADSECRET"
+ ,"UNSECURE"
+ ,"MESSAGEAPI"
+ ,"CONGESTION"
+ ,"FILTER"
+ ,"GROUP"
+ ,"TIMEOUT"
+#ifdef ENABLE_AEAD_API_PREVIEW
+ ,"CRYPTO"
+#endif
+ };
+
+ if (r < int(SRT_REJ_E_SIZE))
+ return reasons[r];
+
+ return Sprint("CODE:", r);
+}
+
// Logging system implementation
#if ENABLE_LOGGING
diff --git a/srtcore/common.h b/srtcore/common.h
index 5021fa5a..ca40d20f 100644
--- a/srtcore/common.h
+++ b/srtcore/common.h
@@ -98,6 +98,8 @@ namespace srt_logging
#if ENABLE_BONDING
std::string MemberStatusStr(SRT_MEMBERSTATUS s);
#endif
+
+ std::string RejectReasonStr(int r);
}
namespace srt
diff --git a/srtcore/core.cpp b/srtcore/core.cpp
index 752eb51b..b9718d21 100644
--- a/srtcore/core.cpp
+++ b/srtcore/core.cpp
@@ -3689,14 +3689,21 @@ void srt::CUDT::startConnect(const sockaddr_any& serv_addr, int32_t forced_isn)
if (cst == CONN_CONTINUE)
continue;
- // Just in case it wasn't set, set this as a fallback
- if (m_RejectReason == SRT_REJ_UNKNOWN)
- m_RejectReason = SRT_REJ_ROGUE;
+ HLOGC(cnlog.Debug,
+ log << CONID() << "startConnect: processRendezvous returned cst=" << ConnectStatusStr(cst)
+ << " rej=" << RejectReasonStr(m_RejectReason.load()));
- // rejection or erroneous code.
- reqpkt.setLength(m_iMaxSRTPayloadSize);
- reqpkt.setControl(UMSG_HANDSHAKE);
- sendRendezvousRejection(serv_addr, (reqpkt));
+ if (cst == CONN_REJECT)
+ {
+ // Just in case it wasn't set, set this as a fallback
+ if (m_RejectReason == SRT_REJ_UNKNOWN)
+ m_RejectReason = SRT_REJ_ROGUE;
+
+ // rejection or erroneous code.
+ reqpkt.setLength(m_iMaxSRTPayloadSize);
+ reqpkt.setControl(UMSG_HANDSHAKE);
+ sendRendezvousRejection(serv_addr, (reqpkt));
+ }
}
if (cst == CONN_REJECT)
@@ -4679,7 +4686,8 @@ bool srt::CUDT::applyResponseSettings(const CPacket* pHspkt /*[[nullable]]*/) AT
HLOGC(cnlog.Debug,
log << CONID() << "applyResponseSettings: HANSHAKE CONCLUDED. SETTING: payload-size=" << m_iMaxSRTPayloadSize
- << " mss=" << m_ConnRes.m_iMSS << " flw=" << m_ConnRes.m_iFlightFlagSize << " isn=" << m_ConnRes.m_iISN
+ << " mss=" << m_ConnRes.m_iMSS << " flw=" << m_ConnRes.m_iFlightFlagSize << " peer-ISN=" << m_ConnRes.m_iISN
+ << " local-ISN=" << m_iISN
<< " peerID=" << m_ConnRes.m_iID
<< " sourceIP=" << m_SourceAddr.str());
return true; |
My proposal actually fixes another problem in rendezvous which was done due to an incorrect fix some time ago, where the rendezvous rejection wasn't properly handled. Important is to add this check if the returned |
@ethouris Please create a separate PR from your proposal. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Initialize the receiver buffer with the peer's initial sequence number, because the peer would be sending.
Before PR #2711 the correct value was set after the RCV buffer had been initialized via
CUDT::applyResponseSettings(..)
.SRT versions with the bug: v1.5.2, v1.5.2.rc.2.
Fixes #2773.