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 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
337 entries_.push_back(entry); | 337 entries_.push_back(entry); |
338 } | 338 } |
339 | 339 |
340 // If the entry is connected, then we can send on it (though wrapping may | 340 // If the entry is connected, then we can send on it (though wrapping may |
341 // still be necessary). Otherwise, we can't yet use this connection, so we | 341 // still be necessary). Otherwise, we can't yet use this connection, so we |
342 // default to the first one. | 342 // default to the first one. |
343 if (!entry || !entry->connected()) { | 343 if (!entry || !entry->connected()) { |
344 ASSERT(!entries_.empty()); | 344 ASSERT(!entries_.empty()); |
345 entry = entries_[0]; | 345 entry = entries_[0]; |
346 if (!entry->connected()) { | 346 if (!entry->connected()) { |
347 error_ = EWOULDBLOCK; | 347 error_ = ENOTCONN; |
348 return SOCKET_ERROR; | 348 return SOCKET_ERROR; |
349 } | 349 } |
350 } | 350 } |
351 | 351 |
352 // Send the actual contents to the server using the usual mechanism. | 352 // Send the actual contents to the server using the usual mechanism. |
353 int sent = entry->SendTo(data, size, addr, options); | 353 int sent = entry->SendTo(data, size, addr, options); |
354 if (sent <= 0) { | 354 if (sent <= 0) { |
355 ASSERT(sent < 0); | 355 ASSERT(sent < 0); |
356 error_ = entry->GetError(); | 356 error_ = entry->GetError(); |
357 return SOCKET_ERROR; | 357 return SOCKET_ERROR; |
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
837 if (rtc::TimeMillis() - 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 |