From d58013f1c352f038fc44ac2b54c1fb802bf23f42 Mon Sep 17 00:00:00 2001 From: Maxim Sharabayko Date: Thu, 4 Mar 2021 12:47:08 +0100 Subject: [PATCH] Minor fixes after self-review --- srtcore/channel.cpp | 6 +++--- srtcore/core.cpp | 25 +++++++++++-------------- srtcore/filelist.maf | 1 + srtcore/socketconfig.h | 2 +- 4 files changed, 16 insertions(+), 18 deletions(-) diff --git a/srtcore/channel.cpp b/srtcore/channel.cpp index b7971b0428..c355107471 100644 --- a/srtcore/channel.cpp +++ b/srtcore/channel.cpp @@ -184,7 +184,7 @@ void CChannel::createSocket(int family) if ((m_mcfg.iIpV6Only != -1) && (family == AF_INET6)) // (not an error if it fails) { int res ATR_UNUSED = ::setsockopt(m_iSocket, IPPROTO_IPV6, IPV6_V6ONLY, - (const char*) &m_mcfg.iIpV6Only, sizeof(int)); + (const char*) &m_mcfg.iIpV6Only, sizeof m_mcfg.iIpV6Only); if (res == -1) { int err = errno; @@ -397,14 +397,14 @@ void CChannel::close() const int CChannel::getSndBufSize() { - socklen_t size = (socklen_t) sizeof m_mcfg.iUDPSndBufSize; + socklen_t size = (socklen_t) sizeof m_mcfg.iUDPSndBufSize; ::getsockopt(m_iSocket, SOL_SOCKET, SO_SNDBUF, (char*) &m_mcfg.iUDPSndBufSize, &size); return m_mcfg.iUDPSndBufSize; } int CChannel::getRcvBufSize() { - socklen_t size = (socklen_t) sizeof m_mcfg.iUDPRcvBufSize; + socklen_t size = (socklen_t) sizeof m_mcfg.iUDPRcvBufSize; ::getsockopt(m_iSocket, SOL_SOCKET, SO_RCVBUF, (char*) &m_mcfg.iUDPRcvBufSize, &size); return m_mcfg.iUDPRcvBufSize; } diff --git a/srtcore/core.cpp b/srtcore/core.cpp index 31fcd1401c..2d5cb2d863 100644 --- a/srtcore/core.cpp +++ b/srtcore/core.cpp @@ -144,18 +144,15 @@ void CUDT::construct() m_RejectReason = SRT_REJ_UNKNOWN; m_tsLastReqTime = steady_clock::time_point(); m_SrtHsSide = HSD_DRAW; - - m_uPeerSrtVersion = 0; // not defined until connected. - - m_iTsbPdDelay_ms = 0; - m_iPeerTsbPdDelay_ms = 0; - - m_bPeerTsbPd = false; - m_iPeerTsbPdDelay_ms = 0; - m_bTsbPd = false; - m_bTsbPdAckWakeup = false; - m_bGroupTsbPd = false; - m_bPeerTLPktDrop = false; + m_uPeerSrtVersion = 0; // not defined until connected. + m_iTsbPdDelay_ms = 0; + m_iPeerTsbPdDelay_ms = 0; + m_bPeerTsbPd = false; + m_iPeerTsbPdDelay_ms = 0; + m_bTsbPd = false; + m_bTsbPdAckWakeup = false; + m_bGroupTsbPd = false; + m_bPeerTLPktDrop = false; // Initilize mutex and condition variables initSynch(); @@ -4328,9 +4325,9 @@ bool CUDT::applyResponseSettings() ATR_NOEXCEPT } // Re-configure according to the negotiated values. - m_config.iMSS = m_ConnRes.m_iMSS; + m_config.iMSS = m_ConnRes.m_iMSS; m_iFlowWindowSize = m_ConnRes.m_iFlightFlagSize; - int udpsize = m_config.iMSS - CPacket::UDP_HDR_SIZE; + const int udpsize = m_config.iMSS - CPacket::UDP_HDR_SIZE; m_iMaxSRTPayloadSize = udpsize - CPacket::HDR_SIZE; m_iPeerISN = m_ConnRes.m_iISN; diff --git a/srtcore/filelist.maf b/srtcore/filelist.maf index 92007db044..bdd57e789d 100644 --- a/srtcore/filelist.maf +++ b/srtcore/filelist.maf @@ -47,6 +47,7 @@ PROTECTED HEADERS platform_sys.h udt.h +PRIVATE HEADERS api.h buffer.h cache.h diff --git a/srtcore/socketconfig.h b/srtcore/socketconfig.h index 0d84915836..59e368c93e 100644 --- a/srtcore/socketconfig.h +++ b/srtcore/socketconfig.h @@ -230,7 +230,7 @@ struct CSrtConfig: CSrtMuxerConfig bool bTLPktDrop; // Whether Agent WILL DO TLPKTDROP on Rx. int iSndDropDelay; // Extra delay when deciding to snd-drop for TLPKTDROP, -1 to off bool bEnforcedEnc; // Off by default. When on, any connection other than nopw-nopw & pw1-pw1 is rejected. - int iGroupConnect; // 1 - allow group connections + int iGroupConnect; // 1 - allow group connections int iPeerIdleTimeout; // Timeout for hearing anything from the peer. uint32_t uStabilityTimeout; int iRetransmitAlgo;