Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/windows-msvc-noenc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- name: configure
run: |
md _build && cd _build
cmake ../ -DENABLE_STDCXX_SYNC=ON -DENABLE_ENCRYPTION=OFF -DENABLE_UNITTESTS=ON -DENABLE_BONDING=ON -DENABLE_LOCALIF_WIN32=ON -DUSE_CXX_STD=c++11
cmake ../ -DENABLE_STDCXX_SYNC=ON -DENABLE_ENCRYPTION=OFF -DENABLE_UNITTESTS=ON -DENABLE_BONDING=ON -DENABLE_LOCALIF_WIN32=ON -DUSE_CXX_STD=c++11 -T v143
- name: build
run: cd _build && cmake --build ./ --config Release --verbose
- name: test
Expand Down
32 changes: 23 additions & 9 deletions configure-data.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -240,36 +240,50 @@ proc GetCompilerCmdName {compiler lang} {
return $compiler${suffix}
}

proc have-option name {
return [info exists ::optval($name)]
}

proc is-option {name value} {
if {![have-option $name]} {
return no
}
if {$::optval($name) eq $value} {
return yes
}
return no
}

proc GetCompilerCommand { {lang {}} } {
# Expect that the compiler was set through:
# --with-compiler-prefix
# --cmake-c[++]-compiler
# (cmake-toolchain-file will set things up without the need to check things here)

set compiler gcc
if { [info exists ::optval(--with-compiler-type)] } {
if { [have-option --with-compiler-type] } {
set compiler $::optval(--with-compiler-type)
}

if { [info exists ::optval(--with-compiler-prefix)] } {
if { [have-option --with-compiler-prefix] } {
set prefix $::optval(--with-compiler-prefix)
return ${prefix}[GetCompilerCmdName $compiler $lang]
} else {
return [GetCompilerCmdName $compiler $lang]
}

if { $lang != "c++" } {
if { [info exists ::optval(--cmake-c-compiler)] } {
if { [have-option --cmake-c-compiler] } {
return $::optval(--cmake-c-compiler)
}
}

if { $lang != "c" } {
if { [info exists ::optval(--cmake-c++-compiler)] } {
if { [have-option --cmake-c++-compiler] } {
return $::optval(--cmake-c++-compiler)
}

if { [info exists ::optval(--cmake-cxx-compiler)] } {
if { [have-option --cmake-cxx-compiler] } {
return $::optval(--cmake-cxx-compiler)
}
}
Expand Down Expand Up @@ -340,12 +354,12 @@ proc postprocess {} {

# Complete the variables before calling cmake, otherwise it might not work

if { [info exists ::optval(--with-compiler-type)] } {
if { ![info exists ::optval(--cmake-c-compiler)] } {
if { [have-option --with-compiler-type] || [have-option --with-compiler-prefix] } {
if { ![have-option --cmake-c-compiler] } {
lappend ::cmakeopt "-DCMAKE_C_COMPILER=[GetCompilerCommand c]"
}

if { ![info exists ::optval(--cmake-c++-compiler)] } {
if { ![have-option --cmake-c++-compiler] } {
lappend ::cmakeopt "-DCMAKE_CXX_COMPILER=[GetCompilerCommand c++]"
}
}
Expand Down Expand Up @@ -439,7 +453,7 @@ proc postprocess {} {
if { $::HAVE_DARWIN && !$toolchain_changed } {
set use_brew 1
}
if { [info exists ::optval(--use-enclib)] && $::optval(--use-enclib) == "botan"} {
if {[is-option --use-enclib botan]} {
set use_brew 0
}

Expand Down
83 changes: 83 additions & 0 deletions scripts/codespell.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
#!/bin/bash

if [[ -z `type -p codespell` ]]; then
echo >&2 "You need 'codespell' app to run the spell check."
echo >&2 "Follow instructions in CONTRIBUTING.md document"
exit 1
fi

function showhelp()
{
echo "Usage: `basename $0` <workmode> <targets>"
echo ""
echo "WORK MODES:"
echo " * show [default] - only show spelling errors"
echo " * fix - write spelling error fixes directly to files"
echo " * check - like fix, but ask user to confirm ambiguous fix"
echo " * review - like fix, but ask user for every modification"
echo "TARGETS:"
echo " * all [default] - check all files in the repository (including index)"
echo " * changed - check only files currently modified in the repository"
}


# Check if the script is run inside the repository view
GIT_TOP=`git rev-parse --show-toplevel` || (echo >&2 "Please run this script in the SRT repository directory"; exit)

# Forcefully enter the top repo dir; this is the only directory where it should be run
cd $GIT_TOP

WORKMODE=${1:-show}
EXTRACTION=${2:-all}

CS_OPTIONS=

case $WORKMODE in
help | --help)
showhelp
exit
;;
show)
;;

fix)
CS_OPTIONS="-w "
;;

check)
CS_OPTIONS="-w -i 2"
;;

review)
CS_OPTIONS="-w -i 1"
;;

*)
echo >&2 "Unknown mode. Use 'help' to list available options."
exit 1
;;
esac

CS_FILES=

if [[ $EXTRACTION == "all" ]]; then
CS_FILES="git ls-files"
elif [[ $EXTRACTION == "changed" ]]; then
CS_FILES="git ls-files -m"
else
echo >&2 "Unknown extractopn spec '$EXTRACTION'. Use 'all' or 'changed'"
exit 1
fi

# Unfortunately this isn't Tcl, so we need to do it "space safe" way.
declare -a FILELIST
eval FILELIST=( $($CS_FILES | awk "{print \"'\" \$1 \"'\"}") )

if [[ -z ${FILELIST[@]} ]]; then
echo "SPELLCHECK: no files listed, not checking."
exit 0
fi

#echo Running in files from $CS_FILE: $FILELIST

codespell --config scripts/codespell/codespell.cfg $CS_OPTIONS ${FILELIST[@]}
1 change: 1 addition & 0 deletions scripts/mafread.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ set insection 0
while { [gets $fd line] >= 0 } {
set oline [string trim $line]
if { $oline == "" } {
set insection no
continue
}

Expand Down
10 changes: 8 additions & 2 deletions scripts/win-installer/build-win-installer.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,15 @@
#-----------------------------------------------------------------------------

<#
.SYNOPSIS
.DESCRIPTION

Build the SRT static libraries installer for Windows.
Build the SRT static libraries installer for Windows.

See README.md for usage details and prerequisites.

.SYNOPSIS

.\build-win-installer.ps1 [-Version DESIRED_VERSION] [-NoBuild] [-NoPause]

.PARAMETER Version

Expand Down
2 changes: 1 addition & 1 deletion srtcore/api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2990,7 +2990,7 @@ void srt::CUDTUnited::removeSocket(const SRTSOCKET u)
return;
}

HLOGC(smlog.Note, log << "@" << s->m_SocketID << " busy=" << s->isStillBusy());
HLOGC(smlog.Debug, log << "@" << s->m_SocketID << " busy=" << s->isStillBusy());

#if ENABLE_BONDING
if (s->m_GroupOf)
Expand Down
3 changes: 2 additions & 1 deletion srtcore/core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7321,7 +7321,8 @@ int srt::CUDT::receiveMessage(char* data, int len, SRT_MSGCTRL& w_mctrl, int by_
? m_pRcvBuffer->readMessage(data, len, &w_mctrl)
: 0;
leaveCS(m_RcvBufferLock);
HLOGC(arlog.Debug, log << CONID() << "AFTER readMsg: (NON-BLOCKING) result=" << res);
HLOGC(arlog.Debug, log << CONID() << "receiveMessage: AFTER readMessage: (NON-BLOCKING) result=" << res
<< " %" << w_mctrl.pktseq << " #" << w_mctrl.msgno);

if (res == 0)
{
Expand Down
3 changes: 1 addition & 2 deletions srtcore/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -149,10 +149,9 @@ enum SeqPairItems
};


// Extended SRT Congestion control class - only an incomplete definition required
class CCryptoControl;

namespace srt {
class CCryptoControl;
class CUDTUnited;
class CUDTSocket;
#if ENABLE_BONDING
Expand Down
2 changes: 2 additions & 0 deletions srtcore/group.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,8 @@ void CUDTGroup::setOpt(SRT_SOCKOPT optName, const void* optval, int optlen)
throw CUDTException(MJ_NOTSUP, MN_INVAL, 0);

case SRTO_SENDER: // deprecated (1.2.0 version legacy)
return; // simply ignore - groups can't be used with HSv4 anyway.

case SRTO_IPV6ONLY: // link-type specific
case SRTO_RENDEZVOUS: // socket-only
case SRTO_BINDTODEVICE: // socket-specific
Expand Down
2 changes: 1 addition & 1 deletion srtcore/packet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,7 @@ inline void SprintSpecialWord(std::ostream& os, int32_t val)
}

#if ENABLE_LOGGING
std::string CPacket::Info()
std::string CPacket::Info() const
{
std::ostringstream os;
os << "TARGET=@" << id() << " ";
Expand Down
8 changes: 4 additions & 4 deletions srtcore/packet.h
Original file line number Diff line number Diff line change
Expand Up @@ -391,11 +391,11 @@ class CPacket
uint32_t header(SrtPktHeaderFields field) const { return m_nHeader[field]; }

#if ENABLE_LOGGING
std::string MessageFlagStr() { return PacketMessageFlagStr(m_nHeader[SRT_PH_MSGNO]); }
std::string Info();
std::string MessageFlagStr() const { return PacketMessageFlagStr(m_nHeader[SRT_PH_MSGNO]); }
std::string Info() const;
#else
std::string MessageFlagStr() { return std::string(); }
std::string Info() { return std::string(); }
std::string MessageFlagStr() const { return std::string(); }
std::string Info() const { return std::string(); }
#endif
};

Expand Down
6 changes: 3 additions & 3 deletions test/test_bonding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -534,15 +534,15 @@ TEST(Bonding, Options)

EXPECT_NE(srt_getsockflag(grp, SRTO_KMSTATE, &kms, &optsize), SRT_ERROR);
EXPECT_EQ(optsize, (int) sizeof kms);
EXPECT_EQ(kms, int(SRT_KM_S_SECURED));
EXPECT_EQ(kms, int32_t(SRT_KM_S_SECURED));

EXPECT_NE(srt_getsockflag(grp, SRTO_PBKEYLEN, &kms, &optsize), SRT_ERROR);
EXPECT_EQ(optsize, (int) sizeof kms);
EXPECT_EQ(kms, 16);
EXPECT_EQ(kms, int32_t(16));

#ifdef ENABLE_AEAD_API_PREVIEW
EXPECT_NE(srt_getsockflag(grp, SRTO_CRYPTOMODE, &kms, &optsize), SRT_ERROR);
EXPECT_EQ(optsize, sizeof kms);
EXPECT_EQ(optsize, int(sizeof kms));
EXPECT_EQ(kms, 1);
#endif
#endif
Expand Down
18 changes: 18 additions & 0 deletions testing/srt-test-mpbond.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,14 +182,32 @@ int main( int argc, char** argv )

Verb() << "LISTENERS [ " << VerbNoEOL;

map<string, string> attr;
for (size_t i = 0; i < args.size(); ++i)
{
UriParser u(args[i], UriParser::EXPECT_HOST);
if (!u.parameters().empty())
{
attr = u.parameters();
attr["mode"] = "listener";
}

sockaddr_any sa = CreateAddr(u.host(), u.portno());

SRTSOCKET s = srt_create_socket();

srt::setopt(s)[SRTO_GROUPCONNECT] = 1;

vector<string> fails;
SrtConfigurePre(s, "", attr, &fails);
if (!fails.empty())
{
cerr << "\nERROR: failure: " << args[i] << ":\n";
for (auto& si: fails)
cerr << "\t" << si << endl;
return 1;
}

srt_bind(s, sa.get(), sizeof sa);
srt_listen(s, 5);

Expand Down
2 changes: 1 addition & 1 deletion testing/testactivemedia.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ struct Medium
std::mutex buffer_lock;
std::thread thr;
std::condition_variable ready;
srt::sync::atomic<bool> running {false};
srt::sync::atomic<bool> running;
std::exception_ptr xp; // To catch exception thrown by a thread

virtual void Runner() = 0;
Expand Down
Loading