Skip to content

Commit

Permalink
Rename StunPacket::Authenticate() to SetPassword()
Browse files Browse the repository at this point in the history
  • Loading branch information
ibc committed Feb 19, 2024
1 parent 2c95e29 commit aeb0d05
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion worker/include/RTC/StunPacket.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ namespace RTC
{
return this->username;
}
void SetPassword(const std::string& password);
uint32_t GetPriority() const
{
return this->priority;
Expand Down Expand Up @@ -197,7 +198,6 @@ namespace RTC
const std::string& password);
StunPacket* CreateSuccessResponse();
StunPacket* CreateErrorResponse(uint16_t errorCode);
void Authenticate(const std::string& password);
void Serialize(uint8_t* buffer);

private:
Expand Down
6 changes: 3 additions & 3 deletions worker/src/RTC/IceServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -432,11 +432,11 @@ namespace RTC
// Authenticate the response.
if (this->oldPassword.empty())
{
response->Authenticate(this->password);
response->SetPassword(this->password);
}
else
{
response->Authenticate(this->oldPassword);
response->SetPassword(this->oldPassword);
}

// Send back.
Expand Down Expand Up @@ -1069,10 +1069,10 @@ namespace RTC
const std::string username = this->remoteUsernameFragment + ":" + this->usernameFragment;

request->SetUsername(username.c_str(), username.length());
request->SetPassword(this->remotePassword);
request->SetPriority(1u);
request->SetIceControlled(1u);
request->SetSoftware(SoftwareAttribute.c_str(), SoftwareAttribute.length());
request->Authenticate(this->remotePassword);
request->Serialize(StunSerializeBuffer);

MS_DEBUG_DEV("sending ICE consent request");
Expand Down
26 changes: 13 additions & 13 deletions worker/src/RTC/StunPacket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,19 @@ namespace RTC
MS_DUMP("</StunPacket>");
}

void StunPacket::SetPassword(const std::string& password)
{
// Just for request, indication and success response messages.
if (this->klass == Class::ERROR_RESPONSE)
{
MS_ERROR("cannot set password for error responses");

return;
}

this->password = password;
}

StunPacket::Authentication StunPacket::CheckAuthentication(
const std::string& usernameFragment1,
const std::string& usernameFragment2,
Expand Down Expand Up @@ -612,19 +625,6 @@ namespace RTC
return response;
}

void StunPacket::Authenticate(const std::string& password)
{
// Just for request, indication and success response messages.
if (this->klass == Class::ERROR_RESPONSE)
{
MS_ERROR("cannot set password for error responses");

return;
}

this->password = password;
}

void StunPacket::Serialize(uint8_t* buffer)
{
MS_TRACE();
Expand Down

0 comments on commit aeb0d05

Please sign in to comment.