Fixed candidate transport parsing

This commit is contained in:
Paul-Louis Ageneau
2021-01-26 11:58:15 +01:00
parent a7e4b56178
commit a0bd65a814

View File

@ -99,7 +99,7 @@ void Candidate::parse(string candidate) {
// See RFC 8445 for format
std::istringstream iss(candidate);
string transport, typ_, type;
string typ_;
if (!(iss >> mFoundation >> mComponent >> mTransportString >> mPriority &&
iss >> mNode >> mService >> typ_ >> mTypeString && typ_ == "typ"))
throw std::invalid_argument("Invalid candidate format");
@ -113,9 +113,9 @@ void Candidate::parse(string candidate) {
else
mType = Type::Unknown;
if (transport == "UDP" || transport == "udp") {
if (mTransportString == "UDP" || mTransportString == "udp") {
mTransportType = TransportType::Udp;
} else if (transport == "TCP" || transport == "tcp") {
} else if (mTransportString == "TCP" || mTransportString == "tcp") {
// Peek tail to find TCP type
std::istringstream tiss(mTail);
string tcptype_, tcptype;