| Index: extensions/browser/api/socket/udp_socket.cc
|
| diff --git a/extensions/browser/api/socket/udp_socket.cc b/extensions/browser/api/socket/udp_socket.cc
|
| index e65957493849ae6d1b85eb500974e712870ecfe6..b4cc0e664ccfb253c8d948da5c301a55ca723cc9 100644
|
| --- a/extensions/browser/api/socket/udp_socket.cc
|
| +++ b/extensions/browser/api/socket/udp_socket.cc
|
| @@ -74,6 +74,10 @@ int UDPSocket::Bind(const std::string& address, uint16_t port) {
|
| if (result != net::OK)
|
| return result;
|
|
|
| + if (IsReusable()) {
|
| + socket_.AllowAddressReuse();
|
| + }
|
| +
|
| result = socket_.Bind(ip_end_point);
|
| if (result != net::OK)
|
| socket_.Close();
|
| @@ -248,6 +252,11 @@ void UDPSocket::OnSendToComplete(int result) {
|
|
|
| bool UDPSocket::IsBound() { return socket_.is_connected(); }
|
|
|
| +bool UDPSocket::IsReusable() {
|
| + // Only ResumableUDPSocket can be reusable
|
| + return false;
|
| +}
|
| +
|
| int UDPSocket::JoinGroup(const std::string& address) {
|
| net::IPAddress ip;
|
| if (!ip.AssignFromIPLiteral(address))
|
| @@ -305,8 +314,13 @@ ResumableUDPSocket::ResumableUDPSocket(const std::string& owner_extension_id)
|
| : UDPSocket(owner_extension_id),
|
| persistent_(false),
|
| buffer_size_(0),
|
| - paused_(false) {}
|
| + paused_(false),
|
| + allow_address_reuse_(false) {}
|
|
|
| bool ResumableUDPSocket::IsPersistent() const { return persistent(); }
|
|
|
| +bool ResumableUDPSocket::IsReusable() {
|
| + return allow_address_reuse();
|
| +}
|
| +
|
| } // namespace extensions
|
|
|