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

Side by Side Diff: runtime/bin/vmstats_impl.cc

Issue 14083007: Add new InternetAddress class with a static lookup function (including IPv6 results). (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix new test. Created 7 years, 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/bin/socket_win.cc ('k') | sdk/lib/io/http_impl.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "bin/vmstats_impl.h" 5 #include "bin/vmstats_impl.h"
6 6
7 #include "bin/file.h" 7 #include "bin/file.h"
8 #include "bin/log.h" 8 #include "bin/log.h"
9 #include "bin/platform.h" 9 #include "bin/platform.h"
10 #include "bin/resources.h" 10 #include "bin/resources.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 ASSERT(instance_monitor_ != NULL); 48 ASSERT(instance_monitor_ != NULL);
49 Socket::Initialize(); 49 Socket::Initialize();
50 50
51 if (root_dir != NULL) { 51 if (root_dir != NULL) {
52 instance_->root_directory_ = root_dir; 52 instance_->root_directory_ = root_dir;
53 } 53 }
54 54
55 // TODO(tball): allow host to be specified. 55 // TODO(tball): allow host to be specified.
56 char* host = const_cast<char*>(DEFAULT_HOST); 56 char* host = const_cast<char*>(DEFAULT_HOST);
57 OSError* os_error; 57 OSError* os_error;
58 const char* host_ip = Socket::LookupIPv4Address(host, &os_error); 58 SocketAddresses* addresses = Socket::LookupAddress(host, -1, &os_error);
59 if (host_ip == NULL) { 59 if (addresses == NULL) {
60 Log::PrintErr("Failed IP lookup of VmStats host %s: %s\n", 60 Log::PrintErr("Failed IP lookup of VmStats host %s: %s\n",
61 host, os_error->message()); 61 host, os_error->message());
62 return; 62 return;
63 } 63 }
64
65 const intptr_t BACKLOG = 128; // Default value from HttpServer.dart 64 const intptr_t BACKLOG = 128; // Default value from HttpServer.dart
66 int64_t address = ServerSocket::CreateBindListen(host_ip, port, BACKLOG); 65 int64_t address = ServerSocket::CreateBindListen(
66 addresses->GetAt(0)->addr(), port, BACKLOG);
67 if (address < 0) { 67 if (address < 0) {
68 Log::PrintErr("Failed binding VmStats socket: %s:%d\n", host, port); 68 Log::PrintErr("Failed binding VmStats socket: %s:%d\n", host, port);
69 return; 69 return;
70 } 70 }
71 instance_->bind_address_ = address; 71 instance_->bind_address_ = address;
72 Log::Print("VmStats URL: http://%s:%"Pd"/\n", host, Socket::GetPort(address)); 72 Log::Print("VmStats URL: http://%s:%"Pd"/\n", host, Socket::GetPort(address));
73 73
74 MonitorLocker ml(instance_monitor_); 74 MonitorLocker ml(instance_monitor_);
75 instance_->running_ = true; 75 instance_->running_ = true;
76 int err = dart::Thread::Start(WebServer, address); 76 int err = dart::Thread::Start(WebServer, address);
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after
465 VmStatusPlugin* plugin = instance_->registered_plugin_list_; 465 VmStatusPlugin* plugin = instance_->registered_plugin_list_;
466 while (plugin != NULL) { 466 while (plugin != NULL) {
467 char* result = (plugin->callback())(request); 467 char* result = (plugin->callback())(request);
468 if (result != NULL) { 468 if (result != NULL) {
469 return result; 469 return result;
470 } 470 }
471 plugin = plugin->next(); 471 plugin = plugin->next();
472 } 472 }
473 return NULL; 473 return NULL;
474 } 474 }
OLDNEW
« no previous file with comments | « runtime/bin/socket_win.cc ('k') | sdk/lib/io/http_impl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698