Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1537)

Unified Diff: native_client_sdk/src/libraries/nacl_io/host_resolver.cc

Issue 349703003: [NaCl SDK] Add some more logging to nacl_io. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix linux host build Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: native_client_sdk/src/libraries/nacl_io/host_resolver.cc
diff --git a/native_client_sdk/src/libraries/nacl_io/host_resolver.cc b/native_client_sdk/src/libraries/nacl_io/host_resolver.cc
index c16fbcb16d2475839a3bb93fd59f8c81489915ff..11648f652298d72caf46c533a85342401bb08924 100644
--- a/native_client_sdk/src/libraries/nacl_io/host_resolver.cc
+++ b/native_client_sdk/src/libraries/nacl_io/host_resolver.cc
@@ -14,6 +14,7 @@
#include <string.h>
#include "nacl_io/kernel_proxy.h"
+#include "nacl_io/log.h"
#include "nacl_io/ossocket.h"
#include "nacl_io/pepper_interface.h"
@@ -227,8 +228,10 @@ int HostResolver::getaddrinfo(const char* node,
*result = NULL;
struct addrinfo* end = NULL;
- if (node == NULL && service == NULL)
+ if (node == NULL && service == NULL) {
+ LOG_TRACE("node and service are NULL.");
return EAI_NONAME;
+ }
// Check the service name (port). Currently we only handle numeric
// services.
@@ -239,6 +242,7 @@ int HostResolver::getaddrinfo(const char* node,
if (port >= 0 && port <= UINT16_MAX && *cp == '\0') {
port = htons(port);
} else {
+ LOG_TRACE("Service \"%s\" not supported.", service);
return EAI_SERVICE;
}
}
@@ -254,6 +258,7 @@ int HostResolver::getaddrinfo(const char* node,
case AF_UNSPEC:
break;
default:
+ LOG_TRACE("Unknown family: %d.", hints->ai_family);
return EAI_FAMILY;
}
@@ -303,16 +308,23 @@ int HostResolver::getaddrinfo(const char* node,
return 0;
}
- if (NULL == ppapi_)
+ if (NULL == ppapi_) {
+ LOG_ERROR("ppapi_ is NULL.");
return EAI_SYSTEM;
+ }
// Use PPAPI interface to resolve nodename
HostResolverInterface* resolver_iface = ppapi_->GetHostResolverInterface();
- VarInterface* var_interface = ppapi_->GetVarInterface();
+ VarInterface* var_iface = ppapi_->GetVarInterface();
NetAddressInterface* netaddr_iface = ppapi_->GetNetAddressInterface();
- if (NULL == resolver_iface || NULL == var_interface || NULL == netaddr_iface)
+ if (!(resolver_iface && var_iface && netaddr_iface)) {
+ LOG_ERROR("Got NULL interface(s): %s%s%s",
+ resolver_iface ? "" : "HostResolver ",
+ var_iface ? "" : "Var ",
+ netaddr_iface ? "" : "NetAddress");
return EAI_SYSTEM;
+ }
ScopedResource scoped_resolver(ppapi_,
resolver_iface->Create(ppapi_->GetInstance()));
@@ -342,7 +354,7 @@ int HostResolver::getaddrinfo(const char* node,
PP_Var name_var = resolver_iface->GetCanonicalName(resolver);
if (PP_VARTYPE_STRING == name_var.type) {
uint32_t len = 0;
- const char* tmp = var_interface->VarToUtf8(name_var, &len);
+ const char* tmp = var_iface->VarToUtf8(name_var, &len);
// For some reason GetCanonicalName alway returns an empty
// string so this condition is never true.
// TODO(sbc): investigate this issue with PPAPI team.
@@ -355,7 +367,7 @@ int HostResolver::getaddrinfo(const char* node,
}
if (!canon_name)
canon_name = strdup(node);
- var_interface->Release(name_var);
+ var_iface->Release(name_var);
}
int num_addresses = resolver_iface->GetNetAddressCount(resolver);
« no previous file with comments | « native_client_sdk/src/libraries/nacl_io/getdents_helper.cc ('k') | native_client_sdk/src/libraries/nacl_io/html5fs/html5_fs.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698