mirror of
https://github.com/mii443/libdatachannel.git
synced 2025-08-22 23:25:33 +00:00
Compare commits
5 Commits
Author | SHA1 | Date | |
---|---|---|---|
0fbdde73e7 | |||
98ea6102b5 | |||
ff702139e4 | |||
0593566ba6 | |||
b325100a7a |
@ -1,7 +1,7 @@
|
||||
cmake_minimum_required(VERSION 3.7)
|
||||
project(libdatachannel
|
||||
DESCRIPTION "WebRTC Data Channels Library"
|
||||
VERSION 0.7.1
|
||||
VERSION 0.7.2
|
||||
LANGUAGES CXX)
|
||||
|
||||
# Options
|
||||
|
@ -82,6 +82,11 @@ std::optional<Description> PeerConnection::remoteDescription() const {
|
||||
}
|
||||
|
||||
void PeerConnection::setLocalDescription(std::optional<Description> description) {
|
||||
if (description)
|
||||
PLOG_VERBOSE << "Setting local description: " << string(*description);
|
||||
else
|
||||
PLOG_VERBOSE << "Setting default local description";
|
||||
|
||||
if (auto iceTransport = std::atomic_load(&mIceTransport)) {
|
||||
throw std::logic_error("Local description is already set");
|
||||
} else {
|
||||
@ -98,6 +103,8 @@ void PeerConnection::setLocalDescription(std::optional<Description> description)
|
||||
}
|
||||
|
||||
void PeerConnection::setRemoteDescription(Description description) {
|
||||
PLOG_VERBOSE << "Setting remote description: " << string(description);
|
||||
|
||||
description.hintType(localDescription() ? Description::Type::Answer : Description::Type::Offer);
|
||||
auto type = description.type();
|
||||
auto remoteCandidates = description.extractCandidates(); // Candidates will be added at the end
|
||||
@ -143,6 +150,7 @@ void PeerConnection::setRemoteDescription(Description description) {
|
||||
}
|
||||
|
||||
void PeerConnection::addRemoteCandidate(Candidate candidate) {
|
||||
PLOG_VERBOSE << "Adding remote candidate: " << string(candidate);
|
||||
|
||||
auto iceTransport = std::atomic_load(&mIceTransport);
|
||||
if (!mRemoteDescription || !iceTransport)
|
||||
|
@ -676,8 +676,16 @@ std::optional<milliseconds> SctpTransport::rtt() {
|
||||
|
||||
int SctpTransport::RecvCallback(struct socket *sock, union sctp_sockstore addr, void *data,
|
||||
size_t len, struct sctp_rcvinfo recv_info, int flags, void *ptr) {
|
||||
int ret = static_cast<SctpTransport *>(ptr)->handleRecv(
|
||||
sock, addr, static_cast<const byte *>(data), len, recv_info, flags);
|
||||
auto *transport = static_cast<SctpTransport *>(ptr);
|
||||
|
||||
std::shared_lock lock(InstancesMutex);
|
||||
if (Instances.find(transport) == Instances.end()) {
|
||||
free(data);
|
||||
return -1;
|
||||
}
|
||||
|
||||
int ret =
|
||||
transport->handleRecv(sock, addr, static_cast<const byte *>(data), len, recv_info, flags);
|
||||
free(data);
|
||||
return ret;
|
||||
}
|
||||
@ -692,8 +700,6 @@ int SctpTransport::SendCallback(struct socket *sock, uint32_t sb_free) {
|
||||
void *ptr = sconn->sconn_addr;
|
||||
auto *transport = static_cast<SctpTransport *>(ptr);
|
||||
|
||||
// Workaround for sctplab/usrsctp#405: Send callback is invoked on already closed socket
|
||||
// https://github.com/sctplab/usrsctp/issues/405
|
||||
std::shared_lock lock(InstancesMutex);
|
||||
if (Instances.find(transport) == Instances.end())
|
||||
return -1;
|
||||
@ -702,8 +708,15 @@ int SctpTransport::SendCallback(struct socket *sock, uint32_t sb_free) {
|
||||
}
|
||||
|
||||
int SctpTransport::WriteCallback(void *ptr, void *data, size_t len, uint8_t tos, uint8_t set_df) {
|
||||
return static_cast<SctpTransport *>(ptr)->handleWrite(static_cast<byte *>(data), len, tos,
|
||||
set_df);
|
||||
auto *transport = static_cast<SctpTransport *>(ptr);
|
||||
|
||||
// Workaround for sctplab/usrsctp#405: Send callback is invoked on already closed socket
|
||||
// https://github.com/sctplab/usrsctp/issues/405
|
||||
std::shared_lock lock(InstancesMutex);
|
||||
if (Instances.find(transport) == Instances.end())
|
||||
return -1;
|
||||
|
||||
return transport->handleWrite(static_cast<byte *>(data), len, tos, set_df);
|
||||
}
|
||||
|
||||
} // namespace rtc
|
||||
|
Reference in New Issue
Block a user