| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "net/udp/udp_socket_libevent.h" | 5 #include "net/udp/udp_socket_libevent.h" |
| 6 | 6 |
| 7 #include <errno.h> | 7 #include <errno.h> |
| 8 #include <fcntl.h> | 8 #include <fcntl.h> |
| 9 #include <netdb.h> | 9 #include <netdb.h> |
| 10 #include <sys/socket.h> | 10 #include <sys/socket.h> |
| 11 | 11 |
| 12 #include "base/callback.h" | 12 #include "base/callback.h" |
| 13 #include "base/eintr_wrapper.h" | |
| 14 #include "base/logging.h" | 13 #include "base/logging.h" |
| 15 #include "base/message_loop.h" | 14 #include "base/message_loop.h" |
| 16 #include "base/metrics/stats_counters.h" | 15 #include "base/metrics/stats_counters.h" |
| 16 #include "base/posix/eintr_wrapper.h" |
| 17 #include "base/rand_util.h" | 17 #include "base/rand_util.h" |
| 18 #include "net/base/io_buffer.h" | 18 #include "net/base/io_buffer.h" |
| 19 #include "net/base/ip_endpoint.h" | 19 #include "net/base/ip_endpoint.h" |
| 20 #include "net/base/net_errors.h" | 20 #include "net/base/net_errors.h" |
| 21 #include "net/base/net_log.h" | 21 #include "net/base/net_log.h" |
| 22 #include "net/base/net_util.h" | 22 #include "net/base/net_util.h" |
| 23 #include "net/udp/udp_net_log_parameters.h" | 23 #include "net/udp/udp_net_log_parameters.h" |
| 24 #if defined(OS_POSIX) | 24 #if defined(OS_POSIX) |
| 25 #include <netinet/in.h> | 25 #include <netinet/in.h> |
| 26 #endif | 26 #endif |
| (...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 501 | 501 |
| 502 for (int i = 0; i < kBindRetries; ++i) { | 502 for (int i = 0; i < kBindRetries; ++i) { |
| 503 int rv = DoBind(IPEndPoint(ip, rand_int_cb_.Run(kPortStart, kPortEnd))); | 503 int rv = DoBind(IPEndPoint(ip, rand_int_cb_.Run(kPortStart, kPortEnd))); |
| 504 if (rv == OK || rv != ERR_ADDRESS_IN_USE) | 504 if (rv == OK || rv != ERR_ADDRESS_IN_USE) |
| 505 return rv; | 505 return rv; |
| 506 } | 506 } |
| 507 return DoBind(IPEndPoint(ip, 0)); | 507 return DoBind(IPEndPoint(ip, 0)); |
| 508 } | 508 } |
| 509 | 509 |
| 510 } // namespace net | 510 } // namespace net |
| OLD | NEW |