Skip to content

Commit 2ef152d

Browse files
authored
Merge pull request #368 from mertushka/fix/peer-connection-wrapper
fix: parameter and return type bugs in peer connection wrapper
2 parents 21601eb + 1c8c5ca commit 2ef152d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/cpp/peer-connection-wrapper.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ PeerConnectionWrapper::PeerConnectionWrapper(const Napi::CallbackInfo &info)
193193
if (proxyServer.Get("username").IsString())
194194
username = proxyServer.Get("username").As<Napi::String>().ToString();
195195
if (proxyServer.Get("password").IsString())
196-
username = proxyServer.Get("password").As<Napi::String>().ToString();
196+
password = proxyServer.Get("password").As<Napi::String>().ToString();
197197

198198
rtcConfig.proxyServer = rtc::ProxyServer(type, ip, port, username, password);
199199
}
@@ -503,7 +503,7 @@ void PeerConnectionWrapper::addRemoteCandidate(const Napi::CallbackInfo &info)
503503
try
504504
{
505505
std::string candidate = info[0].As<Napi::String>().ToString();
506-
std::string mid = info[0].As<Napi::String>().ToString();
506+
std::string mid = info[1].As<Napi::String>().ToString();
507507
mRtcPeerConnPtr->addRemoteCandidate(rtc::Candidate(candidate, mid));
508508
}
509509
catch (std::exception &ex)
@@ -582,7 +582,7 @@ Napi::Value PeerConnectionWrapper::createDataChannel(const Napi::CallbackInfo &i
582582
Napi::TypeError::New(env, "Wrong DataChannel Init Config (unordered)").ThrowAsJavaScriptException();
583583
return info.Env().Null();
584584
}
585-
init.reliability.unordered = !initConfig.Get("unordered").As<Napi::Boolean>();
585+
init.reliability.unordered = initConfig.Get("unordered").As<Napi::Boolean>();
586586
}
587587

588588
if (!initConfig.Get("maxPacketLifeTime").IsUndefined() && !initConfig.Get("maxPacketLifeTime").IsNull() &&
@@ -1087,7 +1087,7 @@ Napi::Value PeerConnectionWrapper::maxMessageSize(const Napi::CallbackInfo &info
10871087

10881088
try
10891089
{
1090-
return Napi::Array::New(env, mRtcPeerConnPtr->remoteMaxMessageSize());
1090+
return Napi::Number::New(env, mRtcPeerConnPtr->remoteMaxMessageSize());
10911091
}
10921092
catch (std::exception &ex)
10931093
{

0 commit comments

Comments
 (0)