mirror of
https://github.com/mii443/libdatachannel.git
synced 2025-12-16 17:08:46 +00:00
Compilation fixes
This commit is contained in:
@@ -29,6 +29,9 @@ namespace rtc {
|
|||||||
|
|
||||||
class Channel {
|
class Channel {
|
||||||
public:
|
public:
|
||||||
|
Channel() = default;
|
||||||
|
virtual ~Channel() = default;
|
||||||
|
|
||||||
virtual void close() = 0;
|
virtual void close() = 0;
|
||||||
virtual bool send(const std::variant<binary, string> &data) = 0; // returns false if buffered
|
virtual bool send(const std::variant<binary, string> &data) = 0; // returns false if buffered
|
||||||
|
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ namespace rtc {
|
|||||||
class SctpTransport;
|
class SctpTransport;
|
||||||
class PeerConnection;
|
class PeerConnection;
|
||||||
|
|
||||||
class DataChannel : public std::enable_shared_from_this<DataChannel>, public Channel {
|
class DataChannel final : public std::enable_shared_from_this<DataChannel>, public Channel {
|
||||||
public:
|
public:
|
||||||
DataChannel(std::weak_ptr<PeerConnection> pc, unsigned int stream, string label,
|
DataChannel(std::weak_ptr<PeerConnection> pc, unsigned int stream, string label,
|
||||||
string protocol, Reliability reliability);
|
string protocol, Reliability reliability);
|
||||||
|
|||||||
@@ -75,14 +75,14 @@ template <typename F, typename T, typename... Args> auto weak_bind(F &&f, T *t,
|
|||||||
if (auto shared_this = weak_this.lock())
|
if (auto shared_this = weak_this.lock())
|
||||||
return bound(args...);
|
return bound(args...);
|
||||||
else
|
else
|
||||||
return (result_type) false;
|
return static_cast<result_type>(false);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename... P> class synchronized_callback {
|
template <typename... P> class synchronized_callback {
|
||||||
public:
|
public:
|
||||||
synchronized_callback() = default;
|
synchronized_callback() = default;
|
||||||
synchronized_callback(std::function<void(P...)> func) { *this = std::move(func); };
|
synchronized_callback(std::function<void(P...)> func) { *this = std::move(func); }
|
||||||
~synchronized_callback() { *this = nullptr; }
|
~synchronized_callback() { *this = nullptr; }
|
||||||
|
|
||||||
synchronized_callback &operator=(std::function<void(P...)> func) {
|
synchronized_callback &operator=(std::function<void(P...)> func) {
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ class SctpTransport;
|
|||||||
using certificate_ptr = std::shared_ptr<Certificate>;
|
using certificate_ptr = std::shared_ptr<Certificate>;
|
||||||
using future_certificate_ptr = std::shared_future<certificate_ptr>;
|
using future_certificate_ptr = std::shared_future<certificate_ptr>;
|
||||||
|
|
||||||
class PeerConnection : public std::enable_shared_from_this<PeerConnection> {
|
class PeerConnection final : public std::enable_shared_from_this<PeerConnection> {
|
||||||
public:
|
public:
|
||||||
enum class State : int {
|
enum class State : int {
|
||||||
New = RTC_NEW,
|
New = RTC_NEW,
|
||||||
|
|||||||
@@ -60,7 +60,10 @@ private:
|
|||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
Queue<T>::Queue(size_t limit, amount_function func) : mLimit(limit), mAmount(0) {
|
Queue<T>::Queue(size_t limit, amount_function func) : mLimit(limit), mAmount(0) {
|
||||||
mAmountFunction = func ? func : [](const T &element) -> size_t { return 1; };
|
mAmountFunction = func ? func : [](const T &element) -> size_t {
|
||||||
|
static_cast<void>(element);
|
||||||
|
return 1;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T> Queue<T>::~Queue() { stop(); }
|
template <typename T> Queue<T>::~Queue() { stop(); }
|
||||||
|
|||||||
Reference in New Issue
Block a user