Skip to content

Commit

Permalink
Reformatting
Browse files Browse the repository at this point in the history
  • Loading branch information
paullouisageneau committed Jun 15, 2024
1 parent 801f742 commit c8c36ad
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions src/impl/peerconnection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,24 +46,22 @@ static LogCounter

const string PemBeginCertificateTag = "-----BEGIN CERTIFICATE-----";

PeerConnection::PeerConnection(Configuration config_)
: config(std::move(config_)) {
PeerConnection::PeerConnection(Configuration config_) : config(std::move(config_)) {
PLOG_VERBOSE << "Creating PeerConnection";


if (config.certificatePemFile && config.keyPemFile) {
std::promise<certificate_ptr> cert;
cert.set_value(std::make_shared<Certificate>(
config.certificatePemFile->find(PemBeginCertificateTag) != string::npos
? Certificate::FromString(*config.certificatePemFile, *config.keyPemFile)
: Certificate::FromFile(*config.certificatePemFile, *config.keyPemFile,
config.keyPemPass.value_or(""))));
config.certificatePemFile->find(PemBeginCertificateTag) != string::npos
? Certificate::FromString(*config.certificatePemFile, *config.keyPemFile)
: Certificate::FromFile(*config.certificatePemFile, *config.keyPemFile,
config.keyPemPass.value_or(""))));
mCertificate = cert.get_future();
} else if (!config.certificatePemFile && !config.keyPemFile) {
mCertificate = make_certificate(config.certificateType);
} else {
throw std::invalid_argument(
"Either none or both certificate and key PEM files must be specified");
"Either none or both certificate and key PEM files must be specified");
}

if (config.portRangeEnd && config.portRangeBegin > config.portRangeEnd)
Expand Down Expand Up @@ -559,7 +557,7 @@ void PeerConnection::forwardMedia([[maybe_unused]] message_ptr message) {
void PeerConnection::dispatchMedia([[maybe_unused]] message_ptr message) {
#if RTC_ENABLE_MEDIA
std::shared_lock lock(mTracksMutex); // read-only
if (mTrackLines.size()==1) {
if (mTrackLines.size() == 1) {
if (auto track = mTrackLines.front().lock())
track->incoming(message);
return;
Expand Down Expand Up @@ -746,7 +744,7 @@ void PeerConnection::iterateDataChannels(
{
std::shared_lock lock(mDataChannelsMutex); // read-only
locked.reserve(mDataChannels.size());
for(auto it = mDataChannels.begin(); it != mDataChannels.end(); ++it) {
for (auto it = mDataChannels.begin(); it != mDataChannels.end(); ++it) {
auto channel = it->second.lock();
if (channel && !channel->isClosed())
locked.push_back(std::move(channel));
Expand Down Expand Up @@ -815,7 +813,7 @@ void PeerConnection::iterateTracks(std::function<void(shared_ptr<Track> track)>
{
std::shared_lock lock(mTracksMutex); // read-only
locked.reserve(mTrackLines.size());
for(auto it = mTrackLines.begin(); it != mTrackLines.end(); ++it) {
for (auto it = mTrackLines.begin(); it != mTrackLines.end(); ++it) {
auto track = it->lock();
if (track && !track->isClosed())
locked.push_back(std::move(track));
Expand Down

0 comments on commit c8c36ad

Please sign in to comment.