Index: webrtc/p2p/base/turnserver.cc |
diff --git a/webrtc/p2p/base/turnserver.cc b/webrtc/p2p/base/turnserver.cc |
index 26d306d519f052b7901713a018ddf73e13e5380e..46e7aa83bc242806e8d932fd1127959cadc8ee15 100644 |
--- a/webrtc/p2p/base/turnserver.cc |
+++ b/webrtc/p2p/base/turnserver.cc |
@@ -118,14 +118,12 @@ static bool InitErrorResponse(const StunMessage* req, int code, |
return true; |
} |
- |
TurnServer::TurnServer(rtc::Thread* thread) |
: thread_(thread), |
nonce_key_(rtc::CreateRandomString(kNonceKeySize)), |
- auth_hook_(NULL), |
- redirect_hook_(NULL), |
- enable_otu_nonce_(false) { |
-} |
+ auth_hook_(nullptr), |
+ redirect_hook_(nullptr), |
+ enable_otu_nonce_(false) {} |
TurnServer::~TurnServer() { |
for (InternalSocketMap::iterator it = server_sockets_.begin(); |
@@ -173,7 +171,7 @@ void TurnServer::AcceptConnection(rtc::AsyncSocket* server_socket) { |
// Check if someone is trying to connect to us. |
rtc::SocketAddress accept_addr; |
rtc::AsyncSocket* accepted_socket = server_socket->Accept(&accept_addr); |
- if (accepted_socket != NULL) { |
+ if (accepted_socket != nullptr) { |
ProtocolType proto = server_listen_sockets_[server_socket]; |
cricket::AsyncStunTCPSocket* tcp_socket = |
new cricket::AsyncStunTCPSocket(accepted_socket, false); |
@@ -228,7 +226,7 @@ void TurnServer::HandleStunMessage(TurnServerConnection* conn, const char* data, |
return; |
} |
- if (redirect_hook_ != NULL && msg.type() == STUN_ALLOCATE_REQUEST) { |
+ if (redirect_hook_ != nullptr && msg.type() == STUN_ALLOCATE_REQUEST) { |
rtc::SocketAddress address; |
if (redirect_hook_->ShouldRedirect(conn->src(), &address)) { |
SendErrorResponseWithAlternateServer( |
@@ -284,7 +282,7 @@ bool TurnServer::GetKey(const StunMessage* msg, std::string* key) { |
} |
std::string username = username_attr->GetString(); |
- return (auth_hook_ != NULL && auth_hook_->GetKey(username, realm_, key)); |
+ return (auth_hook_ != nullptr && auth_hook_->GetKey(username, realm_, key)); |
} |
bool TurnServer::CheckAuthorization(TurnServerConnection* conn, |
@@ -435,10 +433,12 @@ TurnServerAllocation* TurnServer::FindAllocation(TurnServerConnection* conn) { |
TurnServerAllocation* TurnServer::CreateAllocation(TurnServerConnection* conn, |
int proto, |
const std::string& key) { |
- rtc::AsyncPacketSocket* external_socket = (external_socket_factory_) ? |
- external_socket_factory_->CreateUdpSocket(external_addr_, 0, 0) : NULL; |
+ rtc::AsyncPacketSocket* external_socket = |
+ (external_socket_factory_) |
+ ? external_socket_factory_->CreateUdpSocket(external_addr_, 0, 0) |
+ : nullptr; |
if (!external_socket) { |
- return NULL; |
+ return nullptr; |
} |
// The Allocation takes ownership of the socket. |
@@ -603,7 +603,7 @@ std::string TurnServerAllocation::ToString() const { |
} |
void TurnServerAllocation::HandleTurnMessage(const TurnMessage* msg) { |
- RTC_DCHECK(msg != NULL); |
+ RTC_DCHECK(msg != nullptr); |
switch (msg->type()) { |
case STUN_ALLOCATE_REQUEST: |
HandleAllocateRequest(msg); |
@@ -632,7 +632,7 @@ void TurnServerAllocation::HandleAllocateRequest(const TurnMessage* msg) { |
transaction_id_ = msg->transaction_id(); |
const StunByteStringAttribute* username_attr = |
msg->GetByteString(STUN_ATTR_USERNAME); |
- RTC_DCHECK(username_attr != NULL); |
+ RTC_DCHECK(username_attr != nullptr); |
username_ = username_attr->GetString(); |
const StunByteStringAttribute* origin_attr = |
msg->GetByteString(STUN_ATTR_ORIGIN); |
@@ -841,7 +841,7 @@ int TurnServerAllocation::ComputeLifetime(const TurnMessage* msg) { |
} |
bool TurnServerAllocation::HasPermission(const rtc::IPAddress& addr) { |
- return (FindPermission(addr) != NULL); |
+ return (FindPermission(addr) != nullptr); |
} |
void TurnServerAllocation::AddPermission(const rtc::IPAddress& addr) { |
@@ -863,7 +863,7 @@ TurnServerAllocation::Permission* TurnServerAllocation::FindPermission( |
if ((*it)->peer() == addr) |
return *it; |
} |
- return NULL; |
+ return nullptr; |
} |
TurnServerAllocation::Channel* TurnServerAllocation::FindChannel( |
@@ -873,7 +873,7 @@ TurnServerAllocation::Channel* TurnServerAllocation::FindChannel( |
if ((*it)->id() == channel_id) |
return *it; |
} |
- return NULL; |
+ return nullptr; |
} |
TurnServerAllocation::Channel* TurnServerAllocation::FindChannel( |
@@ -883,7 +883,7 @@ TurnServerAllocation::Channel* TurnServerAllocation::FindChannel( |
if ((*it)->peer() == addr) |
return *it; |
} |
- return NULL; |
+ return nullptr; |
} |
void TurnServerAllocation::SendResponse(TurnMessage* msg) { |