OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2004 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 #include <algorithm> | 10 #include <algorithm> |
(...skipping 761 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
772 sent = current_connection_->Send(data, size, options); | 772 sent = current_connection_->Send(data, size, options); |
773 } | 773 } |
774 return sent; | 774 return sent; |
775 } | 775 } |
776 | 776 |
777 AllocateRequest::AllocateRequest(RelayEntry* entry, | 777 AllocateRequest::AllocateRequest(RelayEntry* entry, |
778 RelayConnection* connection) | 778 RelayConnection* connection) |
779 : StunRequest(new RelayMessage()), | 779 : StunRequest(new RelayMessage()), |
780 entry_(entry), | 780 entry_(entry), |
781 connection_(connection) { | 781 connection_(connection) { |
782 start_time_ = rtc::Time64(); | 782 start_time_ = rtc::TimeMillis(); |
783 } | 783 } |
784 | 784 |
785 void AllocateRequest::Prepare(StunMessage* request) { | 785 void AllocateRequest::Prepare(StunMessage* request) { |
786 request->SetType(STUN_ALLOCATE_REQUEST); | 786 request->SetType(STUN_ALLOCATE_REQUEST); |
787 | 787 |
788 StunByteStringAttribute* username_attr = | 788 StunByteStringAttribute* username_attr = |
789 StunAttribute::CreateByteString(STUN_ATTR_USERNAME); | 789 StunAttribute::CreateByteString(STUN_ATTR_USERNAME); |
790 username_attr->CopyBytes( | 790 username_attr->CopyBytes( |
791 entry_->port()->username_fragment().c_str(), | 791 entry_->port()->username_fragment().c_str(), |
792 entry_->port()->username_fragment().size()); | 792 entry_->port()->username_fragment().size()); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
827 void AllocateRequest::OnErrorResponse(StunMessage* response) { | 827 void AllocateRequest::OnErrorResponse(StunMessage* response) { |
828 const StunErrorCodeAttribute* attr = response->GetErrorCode(); | 828 const StunErrorCodeAttribute* attr = response->GetErrorCode(); |
829 if (!attr) { | 829 if (!attr) { |
830 LOG(INFO) << "Bad allocate response error code"; | 830 LOG(INFO) << "Bad allocate response error code"; |
831 } else { | 831 } else { |
832 LOG(INFO) << "Allocate error response:" | 832 LOG(INFO) << "Allocate error response:" |
833 << " code=" << attr->code() | 833 << " code=" << attr->code() |
834 << " reason='" << attr->reason() << "'"; | 834 << " reason='" << attr->reason() << "'"; |
835 } | 835 } |
836 | 836 |
837 if (rtc::Time64() - start_time_ <= kRetryTimeout) | 837 if (rtc::TimeMillis() - start_time_ <= kRetryTimeout) |
838 entry_->ScheduleKeepAlive(); | 838 entry_->ScheduleKeepAlive(); |
839 } | 839 } |
840 | 840 |
841 void AllocateRequest::OnTimeout() { | 841 void AllocateRequest::OnTimeout() { |
842 LOG(INFO) << "Allocate request timed out"; | 842 LOG(INFO) << "Allocate request timed out"; |
843 entry_->HandleConnectFailure(connection_->socket()); | 843 entry_->HandleConnectFailure(connection_->socket()); |
844 } | 844 } |
845 | 845 |
846 } // namespace cricket | 846 } // namespace cricket |
OLD | NEW |