OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2012 The WebRTC Project Authors. All rights reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 << " TURN server credentials for the user."; | 260 << " TURN server credentials for the user."; |
261 OnAllocateError(); | 261 OnAllocateError(); |
262 return; | 262 return; |
263 } | 263 } |
264 | 264 |
265 if (!server_address_.address.port()) { | 265 if (!server_address_.address.port()) { |
266 // We will set default TURN port, if no port is set in the address. | 266 // We will set default TURN port, if no port is set in the address. |
267 server_address_.address.SetPort(TURN_DEFAULT_PORT); | 267 server_address_.address.SetPort(TURN_DEFAULT_PORT); |
268 } | 268 } |
269 | 269 |
270 if (server_address_.address.IsUnresolved()) { | 270 if (server_address_.address.IsUnresolvedIP()) { |
271 ResolveTurnAddress(server_address_.address); | 271 ResolveTurnAddress(server_address_.address); |
272 } else { | 272 } else { |
273 // If protocol family of server address doesn't match with local, return. | 273 // If protocol family of server address doesn't match with local, return. |
274 if (!IsCompatibleAddress(server_address_.address)) { | 274 if (!IsCompatibleAddress(server_address_.address)) { |
275 LOG(LS_ERROR) << "IP address family does not match: " | 275 LOG(LS_ERROR) << "IP address family does not match: " |
276 << "server: " << server_address_.address.family() | 276 << "server: " << server_address_.address.family() |
277 << "local: " << ip().family(); | 277 << "local: " << ip().family(); |
278 OnAllocateError(); | 278 OnAllocateError(); |
279 return; | 279 return; |
280 } | 280 } |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
373 LOG(LS_WARNING) << "Socket is bound to a different address:" | 373 LOG(LS_WARNING) << "Socket is bound to a different address:" |
374 << socket->GetLocalAddress().ipaddr().ToString() | 374 << socket->GetLocalAddress().ipaddr().ToString() |
375 << ", rather then the local port:" << ip().ToString() | 375 << ", rather then the local port:" << ip().ToString() |
376 << ". Discarding TURN port."; | 376 << ". Discarding TURN port."; |
377 OnAllocateError(); | 377 OnAllocateError(); |
378 return; | 378 return; |
379 } | 379 } |
380 } | 380 } |
381 | 381 |
382 state_ = STATE_CONNECTED; // It is ready to send stun requests. | 382 state_ = STATE_CONNECTED; // It is ready to send stun requests. |
383 if (server_address_.address.IsUnresolved()) { | 383 if (server_address_.address.IsUnresolvedIP()) { |
384 server_address_.address = socket_->GetRemoteAddress(); | 384 server_address_.address = socket_->GetRemoteAddress(); |
385 } | 385 } |
386 | 386 |
387 LOG(LS_INFO) << "TurnPort connected to " << socket->GetRemoteAddress() | 387 LOG(LS_INFO) << "TurnPort connected to " << socket->GetRemoteAddress() |
388 << " using tcp."; | 388 << " using tcp."; |
389 SendRequest(new TurnAllocateRequest(this), 0); | 389 SendRequest(new TurnAllocateRequest(this), 0); |
390 } | 390 } |
391 | 391 |
392 void TurnPort::OnSocketClose(rtc::AsyncPacketSocket* socket, int error) { | 392 void TurnPort::OnSocketClose(rtc::AsyncPacketSocket* socket, int error) { |
393 LOG_J(LS_WARNING, this) << "Connection with server failed, error=" << error; | 393 LOG_J(LS_WARNING, this) << "Connection with server failed, error=" << error; |
(...skipping 968 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1362 // bind request as per http://tools.ietf.org/html/rfc5766#section-11.3 | 1362 // bind request as per http://tools.ietf.org/html/rfc5766#section-11.3 |
1363 if (code == STUN_ERROR_STALE_NONCE) { | 1363 if (code == STUN_ERROR_STALE_NONCE) { |
1364 if (port_->UpdateNonce(response)) { | 1364 if (port_->UpdateNonce(response)) { |
1365 // Send channel bind request with fresh nonce. | 1365 // Send channel bind request with fresh nonce. |
1366 SendChannelBindRequest(0); | 1366 SendChannelBindRequest(0); |
1367 } | 1367 } |
1368 } | 1368 } |
1369 } | 1369 } |
1370 | 1370 |
1371 } // namespace cricket | 1371 } // namespace cricket |
OLD | NEW |