mirror of
https://github.com/Haivision/srt.git
synced 2026-07-04 15:07:49 +00:00
[CI] Added configuration for Linux with various matrix combinations (#3300)
* [CI] Added configuration for Linux with various matrix combinations * Some minor fixes * Fixed YAML syntax error * Fixed C++ std spec * Consolidated build options * Fixed exclude list * Fixed exclude list * Fixed matrix combinations * Replaced with two linear matrices * Fixed description * Changed names and split to single files * Blocked matrix, added variants to C++03 * Fixed wrong config on C++03 * Fixed names * Small fixes in crypto matrix * Removed crypto builds. Added MinGW build * Fixed MinGW typo. Added core handling for Linux * Added more platforms with C++11. Unset -Werror for MinGW * Added fixes per build break on MinGW * More Windows fixes * Fixed invalid specialization after fixing for Windows * More fixes for Windows and MinGW * Fixed invalid definition for UDP socket in testing apps * Renamed Windows workflow * Fixed multiple machines for Linux/C++11 syntax * Linux matrix: blocked gdb for other than ubuntu-latest * Linux matrix: blocked gdb for other than ubuntu-latest (fixed syntax error) * Separated preinstallation action to track the problem * Configured noenc on platforms with no SSL available * Separated preinstallation action to track the problem 2 * Blocked installation except ubuntu-latest * Removed slim as it has no access to cmake --------- Co-authored-by: Mikołaj Małecki <mmalecki@haivision.com>
This commit is contained in:
committed by
GitHub
parent
2dc8c18c7e
commit
c39196c9a5
@@ -0,0 +1,37 @@
|
||||
name: Linux
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ "master", "dev" ]
|
||||
pull_request:
|
||||
branches: [ "master", "dev" ]
|
||||
types: [opened, synchronize, reopened]
|
||||
jobs:
|
||||
build:
|
||||
strategy:
|
||||
matrix:
|
||||
crypto: [OFF, openssl, openssl-evp, gnutls, mbedtls, botan]
|
||||
|
||||
name: Build Crypto=${{ matrix.crypto }} C++11
|
||||
runs-on: [ubuntu-latest, ubuntu-slim, ubuntu-24.04-arm]
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Configure packages and system
|
||||
run: |
|
||||
sudo apt install -y tcl cmake libssl-dev libgnutls28-dev libmbedtls-dev libbotan-2-dev gdb
|
||||
echo "core.%e" | sudo tee /proc/sys/kernel/core_pattern
|
||||
- name: Configure
|
||||
run: |
|
||||
mkdir _build && cd _build
|
||||
if [[ ${{ matrix.crypto }} != OFF ]]; then CRYPTO_OPTIONS=-DUSE_ENCLIB=${{ matrix.crypto }}; else CRYPTO_OPTIONS=-DENABLE_ENCRYPTION=OFF; fi
|
||||
cmake ../ -DCMAKE_COMPILE_WARNING_AS_ERROR=ON -DUSE_CXX_STD=11 -DENABLE_STDCXX_SYNC=ON $CRYPTO_OPTIONS -DENABLE_UNITTESTS=ON -DENABLE_BONDING=ON -DENABLE_HEAVY_LOGGING=ON -DENABLE_TESTING=ON -DENABLE_EXAMPLES=ON -DENABLE_CODE_COVERAGE=ON -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
|
||||
- name: Build
|
||||
run: cd _build && make -j -k
|
||||
- name: test
|
||||
run: |
|
||||
ulimit -c unlimited
|
||||
cd _build && ctest --extra-verbose
|
||||
SUCCESS=$?
|
||||
if [ -f core.test-srt ]; then gdb -batch ./test-srt -c core -ex bt -ex "info thread" -ex quit; else echo "NO CORE - NO CRY!"; fi;
|
||||
test $SUCCESS == 0;
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
name: Linux
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ "master", "dev" ]
|
||||
pull_request:
|
||||
branches: [ "master", "dev" ]
|
||||
types: [opened, synchronize, reopened]
|
||||
jobs:
|
||||
build_options:
|
||||
strategy:
|
||||
matrix:
|
||||
cxxstdsync: [OFF, ON]
|
||||
logging: [OFF, ON]
|
||||
bonding: [OFF, ON]
|
||||
cxxstd: ["03", "11"]
|
||||
exclude:
|
||||
- cxxstd: "11"
|
||||
logging: ON
|
||||
bonding: ON
|
||||
- cxxstd: "03"
|
||||
cxxstdsync: ON
|
||||
bonding: OFF
|
||||
name: Build C++${{ matrix.cxxstd }} C++sync=${{ matrix.cxxstdsync }} Bonding=${{ matrix.bonding }} Logging=${{ matrix.logging }}
|
||||
runs-on: [ubuntu-latest, ubuntu-slim, ubuntu-24.04-arm]
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Configure packages and system
|
||||
run: |
|
||||
sudo apt install -y tcl cmake libssl-dev libmbedtls-dev libbotan-2-dev gdb
|
||||
echo "core.%e" | sudo tee /proc/sys/kernel/core_pattern
|
||||
- name: Configure
|
||||
run: |
|
||||
mkdir _build && cd _build
|
||||
# NOTE > Crypto options are default - enabled, openssl
|
||||
cmake ../ -DCMAKE_COMPILE_WARNING_AS_ERROR=ON -DUSE_CXX_STD=${{ matrix.cxxstd }} -DENABLE_STDCXX_SYNC=${{ matrix.cxxstdsync }} -DENABLE_UNITTESTS=ON -DENABLE_BONDING=${{ matrix.bonding }} -DENABLE_LOGGING=${{ matrix.logging }} -DENABLE_HEAVY_LOGGING=${{ matrix.logging }} -DENABLE_TESTING=ON -DENABLE_EXAMPLES=ON -DENABLE_CODE_COVERAGE=ON -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
|
||||
- name: Build
|
||||
run: cd _build && make -j -k
|
||||
- name: test
|
||||
run: |
|
||||
ulimit -c unlimited
|
||||
cd _build && ctest --extra-verbose
|
||||
SUCCESS=$?
|
||||
if [ -f core.test-srt ]; then gdb -batch ./test-srt -c core -ex bt -ex "info thread" -ex quit; else echo "NO CORE - NO CRY!"; fi;
|
||||
test $SUCCESS == 0;
|
||||
|
||||
- name: codecov
|
||||
run: |
|
||||
source ./scripts/collect-gcov.sh
|
||||
bash <(curl -s https://codecov.io/bash)
|
||||
|
||||
build_mingw:
|
||||
name: Build Mingw32
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Dependencies
|
||||
run: |
|
||||
sudo apt install -y g++-mingw-w64-x86-64-posix gcc-mingw-w64-x86-64-posix
|
||||
- name: Configure
|
||||
run: |
|
||||
mkdir _build && cd _build
|
||||
export CC=x86_64-w64-mingw32-gcc-posix CXX=x86_64-w64-mingw32-g++-posix
|
||||
# NOTE > Temporarily blocked encryption due to problems with enclib
|
||||
cmake .. -DCMAKE_COMPILE_WARNING_AS_ERROR=ON -DENABLE_ENCRYPTION=OFF -DENABLE_UNITTESTS=OFF -DUSE_OPENSSL_PC=OFF -DCMAKE_SYSTEM_NAME=Windows
|
||||
- name: Build
|
||||
run: cd _build && make -j -k
|
||||
@@ -1,29 +0,0 @@
|
||||
name: C++03 (old compat)
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ "master", "dev" ]
|
||||
pull_request:
|
||||
branches: [ "master", "dev" ]
|
||||
types: [opened, synchronize, reopened]
|
||||
jobs:
|
||||
build:
|
||||
name: ubuntu
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: configure
|
||||
run: |
|
||||
mkdir _build && cd _build
|
||||
cmake ../ -DCMAKE_COMPILE_WARNING_AS_ERROR=ON -DENABLE_STDCXX_SYNC=OFF -DUSE_CXX_STD=c++03 -DENABLE_ENCRYPTION=ON -DENABLE_UNITTESTS=ON -DENABLE_BONDING=ON -DENABLE_TESTING=ON -DENABLE_EXAMPLES=ON -DENABLE_CODE_COVERAGE=ON -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
|
||||
- name: build
|
||||
# That below is likely SonarQube remains, which was removed earlier.
|
||||
#run: cd _build && build-wrapper-linux-x86-64 --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} cmake --build .
|
||||
run: cd _build && cmake --build .
|
||||
- name: test
|
||||
run: |
|
||||
cd _build && ctest --extra-verbose
|
||||
- name: codecov
|
||||
run: |
|
||||
source ./scripts/collect-gcov.sh
|
||||
bash <(curl -s https://codecov.io/bash)
|
||||
@@ -1,27 +0,0 @@
|
||||
name: C++11
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ "master", "dev" ]
|
||||
pull_request:
|
||||
branches: [ "master", "dev" ]
|
||||
types: [opened, synchronize, reopened]
|
||||
jobs:
|
||||
build:
|
||||
name: ubuntu
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: configure
|
||||
run: |
|
||||
mkdir _build && cd _build
|
||||
cmake ../ -DCMAKE_COMPILE_WARNING_AS_ERROR=ON -DENABLE_STDCXX_SYNC=ON -DENABLE_ENCRYPTION=ON -DENABLE_UNITTESTS=ON -DENABLE_BONDING=ON -DENABLE_TESTING=ON -DENABLE_EXAMPLES=ON -DENABLE_CODE_COVERAGE=ON -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
|
||||
- name: build
|
||||
run: cd _build && cmake --build .
|
||||
- name: test
|
||||
run: |
|
||||
cd _build && ctest --extra-verbose
|
||||
- name: codecov
|
||||
run: |
|
||||
source ./scripts/collect-gcov.sh
|
||||
bash <(curl -s https://codecov.io/bash)
|
||||
@@ -1,4 +1,4 @@
|
||||
name: C++11
|
||||
name: MacOS
|
||||
|
||||
on:
|
||||
push:
|
||||
@@ -8,7 +8,7 @@ on:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: macos
|
||||
name: C++11 noenc
|
||||
runs-on: macos-latest
|
||||
|
||||
steps:
|
||||
@@ -0,0 +1,42 @@
|
||||
name: Ubuntu C++03
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ "master", "dev" ]
|
||||
pull_request:
|
||||
branches: [ "master", "dev" ]
|
||||
types: [opened, synchronize, reopened]
|
||||
jobs:
|
||||
build:
|
||||
strategy:
|
||||
matrix:
|
||||
logging: [OFF, ON]
|
||||
bonding: [OFF, ON]
|
||||
exclude:
|
||||
- bonding: OFF
|
||||
logging: OFF
|
||||
name: logging=${{ matrix.logging }} bonding=${{ matrix.bonding }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: configure
|
||||
run: |
|
||||
sudo apt install -y tcl cmake libssl-dev gdb
|
||||
mkdir _build && cd _build
|
||||
cmake ../ -DCMAKE_COMPILE_WARNING_AS_ERROR=ON -DENABLE_STDCXX_SYNC=OFF -DUSE_CXX_STD=03 -DENABLE_ENCRYPTION=ON -DENABLE_UNITTESTS=ON -DENABLE_BONDING=${{ matrix.bonding }} -DENABLE_TESTING=ON -DENABLE_EXAMPLES=ON -DENABLE_CODE_COVERAGE=ON -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DENABLE_LOGGING=${{ matrix.logging }}
|
||||
- name: build
|
||||
# That below is likely SonarQube remains, which was removed earlier.
|
||||
#run: cd _build && build-wrapper-linux-x86-64 --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} cmake --build .
|
||||
run: cd _build && cmake --build .
|
||||
- name: test
|
||||
run: |
|
||||
echo "core.%e" | sudo tee /proc/sys/kernel/core_pattern
|
||||
ulimit -c unlimited
|
||||
cd _build && ctest --extra-verbose
|
||||
SUCCESS=$?
|
||||
if [ -f core.test-srt ]; then gdb -batch ./test-srt -c core -ex bt -ex "info thread" -ex quit; else echo "NO CORE - NO CRY!"; fi;
|
||||
test $SUCCESS == 0;
|
||||
- name: codecov
|
||||
run: |
|
||||
source ./scripts/collect-gcov.sh
|
||||
bash <(curl -s https://codecov.io/bash)
|
||||
@@ -0,0 +1,46 @@
|
||||
name: Linux C++11
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ "master", "dev" ]
|
||||
pull_request:
|
||||
branches: [ "master", "dev" ]
|
||||
types: [opened, synchronize, reopened]
|
||||
jobs:
|
||||
build:
|
||||
strategy:
|
||||
matrix:
|
||||
# machine: [ubuntu-latest, ubuntu-slim, ubuntu-24.04-arm]
|
||||
# ubuntu-slim excluded because it doesn't have cmake and installation not allowed
|
||||
machine: [ubuntu-latest, ubuntu-24.04-arm]
|
||||
name: ON ${{ matrix.machine }}
|
||||
runs-on: "${{ matrix.machine }}"
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: prepare
|
||||
run: |
|
||||
RUNON=${{ matrix.machine }}
|
||||
if [[ $RUNON == ubuntu-latest ]]; then
|
||||
sudo apt install -y gdb
|
||||
fi
|
||||
- name: configure
|
||||
run: |
|
||||
RUNON=${{ matrix.machine }}
|
||||
ENCRYPTION=ON
|
||||
[[ $RUNON == ubuntu-24.04-arm ]] && ENCRYPTION=OFF
|
||||
mkdir _build && cd _build
|
||||
cmake ../ -DCMAKE_COMPILE_WARNING_AS_ERROR=ON -DUSE_CXX_STD=11 -DENABLE_STDCXX_SYNC=ON -DENABLE_ENCRYPTION=$ENCRYPTION -DENABLE_UNITTESTS=ON -DENABLE_BONDING=ON -DENABLE_TESTING=ON -DENABLE_EXAMPLES=ON -DENABLE_CODE_COVERAGE=ON -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
|
||||
- name: build
|
||||
run: cd _build && cmake --build .
|
||||
- name: test
|
||||
run: |
|
||||
echo "core.%e" | sudo tee /proc/sys/kernel/core_pattern
|
||||
ulimit -c unlimited
|
||||
cd _build && ctest --extra-verbose
|
||||
SUCCESS=$?
|
||||
if [ -f core.test-srt ]; then gdb -batch ./test-srt -c core -ex bt -ex "info thread" -ex quit; else echo "NO CORE - NO CRY!"; fi;
|
||||
test $SUCCESS == 0;
|
||||
- name: codecov
|
||||
run: |
|
||||
source ./scripts/collect-gcov.sh
|
||||
bash <(curl -s https://codecov.io/bash)
|
||||
@@ -0,0 +1,27 @@
|
||||
name: Ubuntu MinGW
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ "master", "dev" ]
|
||||
pull_request:
|
||||
branches: [ "master", "dev" ]
|
||||
types: [opened, synchronize, reopened]
|
||||
jobs:
|
||||
build:
|
||||
name: noenc
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Dependencies
|
||||
run: |
|
||||
sudo apt install -y g++-mingw-w64-x86-64-posix gcc-mingw-w64-x86-64-posix
|
||||
- name: Configure
|
||||
run: |
|
||||
mkdir _build && cd _build
|
||||
export CC=x86_64-w64-mingw32-gcc-posix CXX=x86_64-w64-mingw32-g++-posix
|
||||
#cmake .. -DCMAKE_COMPILE_WARNING_AS_ERROR=ON -DENABLE_ENCRYPTION=OFF -DENABLE_UNITTESTS=OFF -DUSE_OPENSSL_PC=OFF -DCMAKE_SYSTEM_NAME=Windows -DENABLE_BONDING=ON -DENABLE_TESTING=ON -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
|
||||
# Warn-on-error turned off because there's a warning about epoll about unimplemented system fd subscription system
|
||||
cmake .. -DENABLE_ENCRYPTION=OFF -DENABLE_UNITTESTS=OFF -DUSE_OPENSSL_PC=OFF -DCMAKE_SYSTEM_NAME=Windows -DENABLE_BONDING=ON -DENABLE_TESTING=ON -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
|
||||
- name: Build
|
||||
run: cd _build && make -j -k
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
name: C++11
|
||||
name: Windows
|
||||
|
||||
on:
|
||||
push:
|
||||
@@ -9,7 +9,7 @@ on:
|
||||
jobs:
|
||||
build:
|
||||
|
||||
name: windows
|
||||
name: C++11 noenc
|
||||
runs-on: windows-latest
|
||||
|
||||
steps:
|
||||
+1
-1
@@ -37,7 +37,7 @@ using namespace srt;
|
||||
// See:
|
||||
// https://msdn.microsoft.com/en-us/library/windows/desktop/ms742214(v=vs.85).aspx
|
||||
// http://www.winsocketdotnetworkprogramming.com/winsock2programming/winsock2advancedInternet3b.html
|
||||
#if defined(_WIN32) && !defined(HAVE_INET_PTON)
|
||||
#if defined(_WIN32) && !defined(HAVE_INET_PTON) && !defined(InetPton)
|
||||
namespace // Prevent conflict in case when still defined
|
||||
{
|
||||
int inet_pton(int af, const char * src, void * dst)
|
||||
|
||||
@@ -58,14 +58,18 @@ struct SocketOption
|
||||
bool applyt(Object socket, std::string value) const;
|
||||
|
||||
template <Domain D, typename Object>
|
||||
static int setso(Object socket, int protocol, int symbol, const void* data, size_t size);
|
||||
static int setso(Object , int , int , const void* , size_t )
|
||||
{
|
||||
typename Object::something something = Object::something;
|
||||
return -1;
|
||||
}
|
||||
|
||||
template<Type T>
|
||||
bool extract(std::string value, OptionValue& val) const;
|
||||
};
|
||||
|
||||
template<>
|
||||
inline int SocketOption::setso<SocketOption::SRT, int>(int socket, int /*ignored*/, int sym, const void* data, size_t size)
|
||||
inline int SocketOption::setso<SocketOption::SRT, SRTSOCKET>(SRTSOCKET socket, int /*ignored*/, int sym, const void* data, size_t size)
|
||||
{
|
||||
return srt_setsockopt(socket, 0, SRT_SOCKOPT(sym), data, (int) size);
|
||||
}
|
||||
@@ -80,7 +84,7 @@ inline int SocketOption::setso<SocketOption::SRT, SRT_SOCKOPT_CONFIG*>(SRT_SOCKO
|
||||
|
||||
|
||||
template<>
|
||||
inline int SocketOption::setso<SocketOption::SYSTEM, int>(int socket, int proto, int sym, const void* data, size_t size)
|
||||
inline int SocketOption::setso<SocketOption::SYSTEM, SYSSOCKET>(SYSSOCKET socket, int proto, int sym, const void* data, size_t size)
|
||||
{
|
||||
return ::setsockopt(socket, proto, sym, (const char *)data, (int) size);
|
||||
}
|
||||
|
||||
@@ -792,12 +792,12 @@ int main(int argc, char** argv)
|
||||
}
|
||||
if (!srcReady && sysrfdslen > 0)
|
||||
{
|
||||
int sock = src->GetSysSocket();
|
||||
if (sock != -1)
|
||||
SYSSOCKET sock = src->GetSysSocket();
|
||||
if (sock != SYSSOCKET_INVALID)
|
||||
{
|
||||
for (int n = 0; n < sysrfdslen && !(srcReady = (sock == sysrfds[n])); n++);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// read a few chunks at a time in attempt to deplete
|
||||
// read buffers as much as possible on each read event
|
||||
|
||||
@@ -70,7 +70,7 @@ public:
|
||||
};
|
||||
|
||||
virtual SRTSOCKET GetSRTSocket() const { return SRT_INVALID_SOCK; }
|
||||
virtual int GetSysSocket() const { return -1; }
|
||||
virtual SYSSOCKET GetSysSocket() const { return -1; }
|
||||
virtual bool MayBlock() const { return false; }
|
||||
virtual bool AcceptNewClient() { return false; }
|
||||
};
|
||||
@@ -87,7 +87,7 @@ public:
|
||||
virtual ~Target() {}
|
||||
|
||||
virtual SRTSOCKET GetSRTSocket() const { return SRT_INVALID_SOCK; }
|
||||
virtual int GetSysSocket() const { return -1; }
|
||||
virtual SYSSOCKET GetSysSocket() const { return -1; }
|
||||
virtual bool AcceptNewClient() { return false; }
|
||||
};
|
||||
|
||||
|
||||
+10
-10
@@ -744,7 +744,7 @@ public:
|
||||
bool IsOpen() override { return cin.good(); }
|
||||
bool MayBlock() const final { return may_block; }
|
||||
bool End() override { return cin.eof(); }
|
||||
int GetSysSocket() const override { return fileno(stdin); };
|
||||
SYSSOCKET GetSysSocket() const override { return fileno(stdin); };
|
||||
};
|
||||
|
||||
class ConsoleTarget: public Target
|
||||
@@ -773,7 +773,7 @@ public:
|
||||
|
||||
bool IsOpen() override { return cout.good(); }
|
||||
bool Broken() override { return cout.eof(); }
|
||||
int GetSysSocket() const override { return fileno(stdout); };
|
||||
SYSSOCKET GetSysSocket() const override { return fileno(stdout); };
|
||||
};
|
||||
|
||||
template <class Iface> struct Console;
|
||||
@@ -804,7 +804,7 @@ static inline bool IsMulticast(in_addr adr)
|
||||
class UdpCommon
|
||||
{
|
||||
protected:
|
||||
int m_sock = -1;
|
||||
SYSSOCKET m_sock = SYSSOCKET_INVALID;
|
||||
string adapter;
|
||||
sockaddr_any interface_addr;
|
||||
sockaddr_any target_addr;
|
||||
@@ -813,8 +813,8 @@ protected:
|
||||
|
||||
void Setup(string host, int port, map<string,string> attr)
|
||||
{
|
||||
m_sock = (int)socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
|
||||
if (m_sock == -1)
|
||||
m_sock = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
|
||||
if (m_sock == SYSSOCKET_INVALID)
|
||||
Error(SysError(), "UdpCommon::Setup: socket");
|
||||
|
||||
int yes = 1;
|
||||
@@ -957,7 +957,7 @@ protected:
|
||||
~UdpCommon()
|
||||
{
|
||||
#ifdef _WIN32
|
||||
if (m_sock != -1)
|
||||
if (m_sock != SYSSOCKET_INVALID)
|
||||
{
|
||||
shutdown(m_sock, SD_BOTH);
|
||||
closesocket(m_sock);
|
||||
@@ -1038,10 +1038,10 @@ public:
|
||||
return stat;
|
||||
}
|
||||
|
||||
bool IsOpen() override { return m_sock != -1; }
|
||||
bool IsOpen() override { return m_sock != SYSSOCKET_INVALID; }
|
||||
bool End() override { return eof; }
|
||||
|
||||
int GetSysSocket() const override { return m_sock; };
|
||||
SYSSOCKET GetSysSocket() const override { return m_sock; };
|
||||
};
|
||||
|
||||
class UdpTarget: public Target, public UdpCommon
|
||||
@@ -1083,10 +1083,10 @@ public:
|
||||
return stat;
|
||||
}
|
||||
|
||||
bool IsOpen() override { return m_sock != -1; }
|
||||
bool IsOpen() override { return m_sock != SYSSOCKET_INVALID; }
|
||||
bool Broken() override { return false; }
|
||||
|
||||
int GetSysSocket() const override { return m_sock; };
|
||||
SYSSOCKET GetSysSocket() const override { return m_sock; };
|
||||
};
|
||||
|
||||
template <class Iface> struct Udp;
|
||||
|
||||
@@ -879,7 +879,9 @@ int srt::CChannel::sendto(const sockaddr_any& addr, CPacket& packet, const socka
|
||||
if (bCompleted)
|
||||
res = 0;
|
||||
else
|
||||
{
|
||||
LOGC(kslog.Warn, log << "CChannel::sendto call on ::WSAGetOverlappedResult failed with error: " << NET_ERROR);
|
||||
}
|
||||
lEvent.reset();
|
||||
}
|
||||
else
|
||||
|
||||
@@ -142,8 +142,10 @@ static const int32_t SRTGROUP_MASK = (1 << 30);
|
||||
|
||||
#ifdef _WIN32
|
||||
typedef SOCKET SYSSOCKET;
|
||||
static const SYSSOCKET SYSSOCKET_INVALID = INVALID_SOCKET;
|
||||
#else
|
||||
typedef int SYSSOCKET;
|
||||
static const int SYSSOCKET_INVALID = -1;
|
||||
#endif
|
||||
|
||||
#ifndef ENABLE_BONDING
|
||||
|
||||
@@ -274,7 +274,7 @@ int main( int argc, char** argv )
|
||||
for (auto& s: output_spec)
|
||||
Verb() << "\t" << s;
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#if defined(_MSC_VER) || defined(__MINGW32__)
|
||||
// Replacement for sigaction, just use 'signal'
|
||||
// This may make this working kinda impaired and unexpected,
|
||||
// but still better that not compiling at all.
|
||||
|
||||
@@ -2747,7 +2747,7 @@ static inline bool IsMulticast(in_addr adr)
|
||||
void UdpCommon::Setup(string host, int port, map<string,string> attr)
|
||||
{
|
||||
m_sock = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
|
||||
if (m_sock == -1)
|
||||
if (m_sock == SYSSOCKET_INVALID)
|
||||
Error(SysError(), "UdpCommon::Setup: socket");
|
||||
|
||||
int yes = 1;
|
||||
@@ -2878,11 +2878,11 @@ void UdpCommon::Error(int err, string src)
|
||||
UdpCommon::~UdpCommon()
|
||||
{
|
||||
#ifdef _WIN32
|
||||
if (m_sock != -1)
|
||||
if (m_sock != SYSSOCKET_INVALID)
|
||||
{
|
||||
shutdown(m_sock, SD_BOTH);
|
||||
closesocket(m_sock);
|
||||
m_sock = -1;
|
||||
m_sock = SYSSOCKET_INVALID;
|
||||
}
|
||||
#else
|
||||
close(m_sock);
|
||||
|
||||
@@ -303,7 +303,7 @@ public:
|
||||
class UdpCommon
|
||||
{
|
||||
protected:
|
||||
int m_sock = -1;
|
||||
SYSSOCKET m_sock = -1;
|
||||
std::string adapter;
|
||||
srt::sockaddr_any interface_addr;
|
||||
srt::sockaddr_any target_addr;
|
||||
@@ -325,7 +325,7 @@ public:
|
||||
|
||||
MediaPacket Read(size_t chunk) override;
|
||||
|
||||
bool IsOpen() override { return m_sock != -1; }
|
||||
bool IsOpen() override { return m_sock != SYSSOCKET_INVALID; }
|
||||
bool End() override { return eof; }
|
||||
};
|
||||
|
||||
@@ -335,7 +335,7 @@ public:
|
||||
UdpTarget(std::string host, int port, const std::map<std::string,std::string>& attr);
|
||||
|
||||
void Write(const MediaPacket& data) override;
|
||||
bool IsOpen() override { return m_sock != -1; }
|
||||
bool IsOpen() override { return m_sock != SYSSOCKET_INVALID; }
|
||||
bool Broken() override { return false; }
|
||||
};
|
||||
|
||||
@@ -348,7 +348,7 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
bool IsOpen() override { return m_sock != -1; }
|
||||
bool IsOpen() override { return m_sock != SYSSOCKET_INVALID; }
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user