| 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_posix.h" | 5 #include "net/udp/udp_socket_posix.h" |
| 6 | 6 |
| 7 #include <errno.h> | 7 #include <errno.h> |
| 8 #include <fcntl.h> | 8 #include <fcntl.h> |
| 9 #include <net/if.h> | 9 #include <net/if.h> |
| 10 #include <netdb.h> | 10 #include <netdb.h> |
| (...skipping 720 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 731 #endif | 731 #endif |
| 732 return MapSystemError(last_error); | 732 return MapSystemError(last_error); |
| 733 } | 733 } |
| 734 | 734 |
| 735 int UDPSocketPosix::RandomBind(const IPAddress& address) { | 735 int UDPSocketPosix::RandomBind(const IPAddress& address) { |
| 736 DCHECK(bind_type_ == DatagramSocket::RANDOM_BIND && !rand_int_cb_.is_null()); | 736 DCHECK(bind_type_ == DatagramSocket::RANDOM_BIND && !rand_int_cb_.is_null()); |
| 737 | 737 |
| 738 for (int i = 0; i < kBindRetries; ++i) { | 738 for (int i = 0; i < kBindRetries; ++i) { |
| 739 int rv = DoBind(IPEndPoint(address, | 739 int rv = DoBind(IPEndPoint(address, |
| 740 rand_int_cb_.Run(kPortStart, kPortEnd))); | 740 rand_int_cb_.Run(kPortStart, kPortEnd))); |
| 741 if (rv == OK || rv != ERR_ADDRESS_IN_USE) | 741 if (rv != ERR_ADDRESS_IN_USE) |
| 742 return rv; | 742 return rv; |
| 743 } | 743 } |
| 744 return DoBind(IPEndPoint(address, 0)); | 744 return DoBind(IPEndPoint(address, 0)); |
| 745 } | 745 } |
| 746 | 746 |
| 747 int UDPSocketPosix::JoinGroup(const IPAddress& group_address) const { | 747 int UDPSocketPosix::JoinGroup(const IPAddress& group_address) const { |
| 748 DCHECK(CalledOnValidThread()); | 748 DCHECK(CalledOnValidThread()); |
| 749 if (!is_connected()) | 749 if (!is_connected()) |
| 750 return ERR_SOCKET_NOT_CONNECTED; | 750 return ERR_SOCKET_NOT_CONNECTED; |
| 751 | 751 |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 879 return MapSystemError(errno); | 879 return MapSystemError(errno); |
| 880 | 880 |
| 881 return OK; | 881 return OK; |
| 882 } | 882 } |
| 883 | 883 |
| 884 void UDPSocketPosix::DetachFromThread() { | 884 void UDPSocketPosix::DetachFromThread() { |
| 885 base::NonThreadSafe::DetachFromThread(); | 885 base::NonThreadSafe::DetachFromThread(); |
| 886 } | 886 } |
| 887 | 887 |
| 888 } // namespace net | 888 } // namespace net |
| OLD | NEW |