| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "chrome/browser/local_discovery/service_discovery_client_mac.h" | 5 #include "chrome/browser/local_discovery/service_discovery_client_mac.h" |
| 6 | 6 |
| 7 #import <arpa/inet.h> | 7 #import <arpa/inet.h> |
| 8 #import <Foundation/Foundation.h> | 8 #import <Foundation/Foundation.h> |
| 9 #import <net/if_dl.h> | 9 #import <net/if_dl.h> |
| 10 | 10 |
| (...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 service_description_.service_name = service_name_; | 345 service_description_.service_name = service_name_; |
| 346 | 346 |
| 347 for (NSData* address in [service_ addresses]) { | 347 for (NSData* address in [service_ addresses]) { |
| 348 const void* bytes = [address bytes]; | 348 const void* bytes = [address bytes]; |
| 349 int length = [address length]; | 349 int length = [address length]; |
| 350 const sockaddr* socket = static_cast<const sockaddr*>(bytes); | 350 const sockaddr* socket = static_cast<const sockaddr*>(bytes); |
| 351 net::IPEndPoint end_point; | 351 net::IPEndPoint end_point; |
| 352 if (end_point.FromSockAddr(socket, length)) { | 352 if (end_point.FromSockAddr(socket, length)) { |
| 353 service_description_.address = | 353 service_description_.address = |
| 354 net::HostPortPair::FromIPEndPoint(end_point); | 354 net::HostPortPair::FromIPEndPoint(end_point); |
| 355 service_description_.ip_address = end_point.address(); |
| 355 break; | 356 break; |
| 356 } | 357 } |
| 357 } | 358 } |
| 358 | 359 |
| 359 if (service_description_.address.host().empty()) { | 360 if (service_description_.address.host().empty()) { |
| 360 VLOG(1) << "Service IP is not resolved: " << service_name_; | 361 VLOG(1) << "Service IP is not resolved: " << service_name_; |
| 361 callback_runner_->PostTask( | 362 callback_runner_->PostTask( |
| 362 FROM_HERE, | 363 FROM_HERE, |
| 363 base::Bind(callback_, STATUS_KNOWN_NONEXISTENT, ServiceDescription())); | 364 base::Bind(callback_, STATUS_KNOWN_NONEXISTENT, ServiceDescription())); |
| 364 return; | 365 return; |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 480 container_->OnResolveUpdate(local_discovery::ServiceResolver::STATUS_SUCCESS); | 481 container_->OnResolveUpdate(local_discovery::ServiceResolver::STATUS_SUCCESS); |
| 481 } | 482 } |
| 482 | 483 |
| 483 - (void)netService:(NSNetService *)sender | 484 - (void)netService:(NSNetService *)sender |
| 484 didNotResolve:(NSDictionary *)errorDict { | 485 didNotResolve:(NSDictionary *)errorDict { |
| 485 container_->OnResolveUpdate( | 486 container_->OnResolveUpdate( |
| 486 local_discovery::ServiceResolver::STATUS_REQUEST_TIMEOUT); | 487 local_discovery::ServiceResolver::STATUS_REQUEST_TIMEOUT); |
| 487 } | 488 } |
| 488 | 489 |
| 489 @end | 490 @end |
| OLD | NEW |