diff --git a/include/rtc/datachannel.hpp b/include/rtc/datachannel.hpp index 6301381..8408ef5 100644 --- a/include/rtc/datachannel.hpp +++ b/include/rtc/datachannel.hpp @@ -88,13 +88,13 @@ private: friend class PeerConnection; }; -class RTC_CPP_EXPORT NegociatedDataChannel final : public DataChannel { +class RTC_CPP_EXPORT NegotiatedDataChannel final : public DataChannel { public: - NegociatedDataChannel(std::weak_ptr pc, uint16_t stream, string label, + NegotiatedDataChannel(std::weak_ptr pc, uint16_t stream, string label, string protocol, Reliability reliability); - NegociatedDataChannel(std::weak_ptr pc, std::weak_ptr transport, + NegotiatedDataChannel(std::weak_ptr pc, std::weak_ptr transport, uint16_t stream); - ~NegociatedDataChannel(); + ~NegotiatedDataChannel(); private: void open(std::shared_ptr transport) override; diff --git a/src/datachannel.cpp b/src/datachannel.cpp index 98b0d45..2ac1fdc 100644 --- a/src/datachannel.cpp +++ b/src/datachannel.cpp @@ -235,20 +235,20 @@ void DataChannel::incoming(message_ptr message) { } } -NegociatedDataChannel::NegociatedDataChannel(std::weak_ptr pc, uint16_t stream, +NegotiatedDataChannel::NegotiatedDataChannel(std::weak_ptr pc, uint16_t stream, string label, string protocol, Reliability reliability) : DataChannel(pc, stream, std::move(label), std::move(protocol), std::move(reliability)) {} -NegociatedDataChannel::NegociatedDataChannel(std::weak_ptr pc, +NegotiatedDataChannel::NegotiatedDataChannel(std::weak_ptr pc, std::weak_ptr transport, uint16_t stream) : DataChannel(pc, stream, "", "", {}) { mSctpTransport = transport; } -NegociatedDataChannel::~NegociatedDataChannel() {} +NegotiatedDataChannel::~NegotiatedDataChannel() {} -void NegociatedDataChannel::open(shared_ptr transport) { +void NegotiatedDataChannel::open(shared_ptr transport) { mSctpTransport = transport; uint8_t channelType; @@ -290,7 +290,7 @@ void NegociatedDataChannel::open(shared_ptr transport) { transport->send(make_message(buffer.begin(), buffer.end(), Message::Control, mStream)); } -void NegociatedDataChannel::processOpenMessage(message_ptr message) { +void NegotiatedDataChannel::processOpenMessage(message_ptr message) { auto transport = mSctpTransport.lock(); if (!transport) throw std::runtime_error("DataChannel has no transport"); diff --git a/src/peerconnection.cpp b/src/peerconnection.cpp index 4ced150..e58b8d9 100644 --- a/src/peerconnection.cpp +++ b/src/peerconnection.cpp @@ -663,7 +663,7 @@ void PeerConnection::forwardMessage(message_ptr message) { if (message->type == Message::Control && *message->data() == dataChannelOpenMessage && stream % 2 == remoteParity) { - channel = std::make_shared(shared_from_this(), sctpTransport, + channel = std::make_shared(shared_from_this(), sctpTransport, stream); channel->onOpen(weak_bind(&PeerConnection::triggerDataChannel, this, weak_ptr{channel})); @@ -835,7 +835,7 @@ shared_ptr PeerConnection::emplaceDataChannel(Description::Role rol init.negotiated ? std::make_shared(shared_from_this(), stream, std::move(label), std::move(init.protocol), std::move(init.reliability)) - : std::make_shared(shared_from_this(), stream, std::move(label), + : std::make_shared(shared_from_this(), stream, std::move(label), std::move(init.protocol), std::move(init.reliability)); mDataChannels.emplace(std::make_pair(stream, channel)); diff --git a/test/connectivity.cpp b/test/connectivity.cpp index f3af281..eb9698a 100644 --- a/test/connectivity.cpp +++ b/test/connectivity.cpp @@ -221,7 +221,7 @@ void test_connectivity() { auto negotiated2 = pc2->createDataChannel("negoctated", init); if (!negotiated1->isOpen() || !negotiated2->isOpen()) - throw runtime_error("Negociated DataChannel is not open"); + throw runtime_error("Negotiated DataChannel is not open"); std::atomic received = false; negotiated2->onMessage([&received](const variant &message) { @@ -239,7 +239,7 @@ void test_connectivity() { this_thread::sleep_for(1s); if (!received) - throw runtime_error("Negociated DataChannel failed"); + throw runtime_error("Negotiated DataChannel failed"); // Delay close of peer 2 to check closing works properly pc1->close(); diff --git a/test/turn_connectivity.cpp b/test/turn_connectivity.cpp index 4024602..e80de78 100644 --- a/test/turn_connectivity.cpp +++ b/test/turn_connectivity.cpp @@ -232,7 +232,7 @@ void test_turn_connectivity() { auto negotiated2 = pc2->createDataChannel("negoctated", init); if (!negotiated1->isOpen() || !negotiated2->isOpen()) - throw runtime_error("Negociated DataChannel is not open"); + throw runtime_error("Negotiated DataChannel is not open"); std::atomic received = false; negotiated2->onMessage([&received](const variant &message) { @@ -250,7 +250,7 @@ void test_turn_connectivity() { this_thread::sleep_for(1s); if (!received) - throw runtime_error("Negociated DataChannel failed"); + throw runtime_error("Negotiated DataChannel failed"); // Delay close of peer 2 to check closing works properly pc1->close();