Skip to content

Commit

Permalink
Updated to latest upstream. Added some more fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Mikołaj Małecki committed Aug 30, 2024
2 parents 596c436 + 9c7206f commit 24ed1b3
Show file tree
Hide file tree
Showing 58 changed files with 1,921 additions and 958 deletions.
10 changes: 3 additions & 7 deletions .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ configuration:
- Debug

image:
- Visual Studio 2022
- Visual Studio 2019
- Visual Studio 2015
- Visual Studio 2013

platform:
- x64
Expand All @@ -14,12 +14,8 @@ platform:
build_script:
- ps: $VSIMG = $Env:APPVEYOR_BUILD_WORKER_IMAGE; $CNFG = $Env:CONFIGURATION
# use a few differing arguments depending on VS version to exercise different options during builds
- ps: if ($VSIMG -match '2019' -and $CNFG -eq "Release") { .\scripts\build-windows.ps1 -STATIC_LINK_SSL ON -BUILD_APPS ON -UNIT_TESTS ON -BONDING ON }
- ps: if ($VSIMG -match '2019' -and $CNFG -eq "Debug") { .\scripts\build-windows.ps1 -STATIC_LINK_SSL ON -BUILD_APPS ON }
- ps: if ($VSIMG -match '2015' -and $CNFG -eq "Release") { .\scripts\build-windows.ps1 -STATIC_LINK_SSL ON -BUILD_APPS ON -UNIT_TESTS ON -BONDING ON}
- ps: if ($VSIMG -match '2015' -and $CNFG -eq "Debug") { .\scripts\build-windows.ps1 -STATIC_LINK_SSL ON -BUILD_APPS OFF }
- ps: if ($VSIMG -match '2013' -and $CNFG -eq "Release") { .\scripts\build-windows.ps1 -CXX11 OFF -BUILD_APPS ON }
- ps: if ($VSIMG -match '2013' -and $CNFG -eq "Debug") { Exit-AppveyorBuild } # just skip 2013 debug build for speed
- ps: if ($CNFG -eq "Release") { .\scripts\build-windows.ps1 -STATIC_LINK_SSL ON -BUILD_APPS ON -UNIT_TESTS ON -BONDING ON}
- ps: if ($CNFG -eq "Debug") { if ($VSIMG -match '2015') { .\scripts\build-windows.ps1 -STATIC_LINK_SSL ON -BUILD_APPS OFF } else {.\scripts\build-windows.ps1 -STATIC_LINK_SSL ON -BUILD_APPS ON }}

test_script:
- ps: if ( $Env:RUN_UNIT_TESTS ) { cd ./_build; ctest -E "TestIPv6.v6_calls_v4" --extra-verbose -C $Env:CONFIGURATION; cd ../ }
Expand Down
4 changes: 1 addition & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#

cmake_minimum_required (VERSION 2.8.12 FATAL_ERROR)
set (SRT_VERSION 1.5.3)
set (SRT_VERSION 1.5.4)

set (CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/scripts")
include(haiUtil) # needed for set_version_variables
Expand Down Expand Up @@ -1383,7 +1383,6 @@ if (ENABLE_APPS)
# srt-multiplex temporarily blocked
#srt_add_application(srt-multiplex ${VIRTUAL_srtsupport})
srt_add_application(srt-tunnel ${VIRTUAL_srtsupport})
target_compile_definitions(srt-tunnel PUBLIC -DSRT_ENABLE_VERBOSE_LOCK)
endif()

if (ENABLE_TESTING)
Expand Down Expand Up @@ -1421,7 +1420,6 @@ if (ENABLE_APPS)

srt_add_testprogram(srt-test-relay)
srt_make_application(srt-test-relay)
target_compile_definitions(srt-test-relay PUBLIC -DSRT_ENABLE_VERBOSE_LOCK)

srt_add_testprogram(srt-test-multiplex)
srt_make_application(srt-test-multiplex)
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

[![License: MPLv2.0][license-badge]](./LICENSE)
[![Latest release][release-badge]][github releases]
[![Quality Gate Status][sonarcloud-badge]][sonarcloud-project]
[![codecov][codecov-badge]][codecov-project]
[![Build Status Linux and macOS][travis-badge]][travis]
[![Build Status Windows][appveyor-badge]][appveyor]
Expand Down Expand Up @@ -225,6 +226,9 @@ By contributing code to the SRT project, you agree to license your contribution
[ConanCenter-package]: https://repology.org/project/srt/versions
[ConanCenter-badge]: https://repology.org/badge/version-for-repo/conancenter/srt.svg

[sonarcloud-project]: https://sonarcloud.io/project/overview?id=srt
[sonarcloud-badge]: https://sonarcloud.io/api/project_badges/measure?project=srt&metric=alert_status

[codecov-project]: https://codecov.io/gh/haivision/srt
[codecov-badge]: https://codecov.io/gh/haivision/srt/branch/master/graph/badge.svg

Expand Down
13 changes: 3 additions & 10 deletions apps/verbose.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,13 @@
*/

#include "verbose.hpp"
#include "sync.h" // srt::sync

namespace Verbose
{
bool on = false;
std::ostream* cverb = &std::cerr;
#if SRT_ENABLE_VERBOSE_LOCK
std::mutex vlock;
#endif
srt::sync::Mutex vlock;

Log& Log::operator<<(LogNoEol)
{
Expand All @@ -28,27 +27,24 @@ namespace Verbose
return *this;
}

#if SRT_ENABLE_VERBOSE_LOCK
Log& Log::operator<<(LogLock)
{
lockline = true;
return *this;
}
#endif

Log::~Log()
{
if (on && !noeol)
{
#if SRT_ENABLE_VERBOSE_LOCK
if (lockline)
{
// Lock explicitly, as requested, and wait for the opportunity.
vlock.lock();
}
else if (vlock.try_lock())
{
// Successfully locked, so unlock immediately, locking wasn't requeted.
// Successfully locked, so unlock immediately, locking wasn't requested.
vlock.unlock();
}
else
Expand All @@ -62,15 +58,12 @@ namespace Verbose
vlock.lock();
vlock.unlock();
}
#endif
(*cverb) << std::endl;
#if SRT_ENABLE_VERBOSE_LOCK

// If lockline is set, the lock was requested and WAS DONE, so unlock.
// Otherwise locking WAS NOT DONE.
if (lockline)
vlock.unlock();
#endif
}
}
}
29 changes: 15 additions & 14 deletions apps/verbose.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@
#define INC_SRT_VERBOSE_HPP

#include <iostream>
#if SRT_ENABLE_VERBOSE_LOCK
#include <mutex>
#endif
#include "atomic.h"

namespace Verbose
{
Expand All @@ -23,22 +21,22 @@ extern bool on;
extern std::ostream* cverb;

struct LogNoEol { LogNoEol() {} };
#if SRT_ENABLE_VERBOSE_LOCK
struct LogLock { LogLock() {} };
#endif

class Log
{
bool noeol = false;
#if SRT_ENABLE_VERBOSE_LOCK
bool lockline = false;
#endif
srt::sync::atomic<bool> lockline;

// Disallow creating dynamic objects
void* operator new(size_t);
void* operator new(size_t) = delete;

public:

Log() {}
Log(const Log& ) {}


template <class V>
Log& operator<<(const V& arg)
{
Expand All @@ -50,9 +48,7 @@ class Log
}

Log& operator<<(LogNoEol);
#if SRT_ENABLE_VERBOSE_LOCK
Log& operator<<(LogLock);
#endif
~Log();
};

Expand Down Expand Up @@ -80,7 +76,7 @@ inline void Print(Log& ) {}
template <typename Arg1, typename... Args>
inline void Print(Log& out, Arg1&& arg1, Args&&... args)
{
out << std::forward(arg1);
out << arg1;
Print(out, args...);
}

Expand All @@ -96,11 +92,16 @@ inline void Verb(Args&&... args)
Verbose::Print(log, args...);
}

template <typename... Args>
inline void Verror(Args&&... args)
{
Verbose::ErrLog log;
Verbose::Print(log, args...);
}


// Manipulator tags
static const Verbose::LogNoEol VerbNoEOL;
#if SRT_ENABLE_VERBOSE_LOCK
static const Verbose::LogLock VerbLock;
#endif

#endif
2 changes: 2 additions & 0 deletions docs/API/API-functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,8 @@ Since SRT v1.5.0.
| [SRT_REJ_CRYPTO](#SRT_REJ_CRYPTO) | 1.5.2 | The connection was rejected due to an unsupported or mismatching encryption mode |
| <img width=290px height=1px/> | | |

See the full list in [Rejection Reason Codes](./rejection-codes.md).

<h4 id="error-codes">Error Codes</h4>

| *Error Code* | *Description* |
Expand Down
Loading

0 comments on commit 24ed1b3

Please sign in to comment.