| OLD | NEW |
| 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 ASSERT(instance_monitor_ != NULL); | 52 ASSERT(instance_monitor_ != NULL); |
| 53 Socket::Initialize(); | 53 Socket::Initialize(); |
| 54 | 54 |
| 55 if (root_dir != NULL) { | 55 if (root_dir != NULL) { |
| 56 instance_->root_directory_ = root_dir; | 56 instance_->root_directory_ = root_dir; |
| 57 } | 57 } |
| 58 | 58 |
| 59 // TODO(tball): allow host to be specified. | 59 // TODO(tball): allow host to be specified. |
| 60 char* host = const_cast<char*>(DEFAULT_HOST); | 60 char* host = const_cast<char*>(DEFAULT_HOST); |
| 61 OSError* os_error; | 61 OSError* os_error; |
| 62 SocketAddresses* addresses = Socket::LookupAddress(host, -1, &os_error); | 62 AddressList<SocketAddress>* addresses = |
| 63 Socket::LookupAddress(host, -1, &os_error); |
| 63 if (addresses == NULL) { | 64 if (addresses == NULL) { |
| 64 Log::PrintErr("Failed IP lookup of VmStats host %s: %s\n", | 65 Log::PrintErr("Failed IP lookup of VmStats host %s: %s\n", |
| 65 host, os_error->message()); | 66 host, os_error->message()); |
| 66 return; | 67 return; |
| 67 } | 68 } |
| 68 const intptr_t BACKLOG = 128; // Default value from HttpServer.dart | 69 const intptr_t BACKLOG = 128; // Default value from HttpServer.dart |
| 69 int64_t address = ServerSocket::CreateBindListen( | 70 int64_t address = ServerSocket::CreateBindListen( |
| 70 addresses->GetAt(0)->addr(), port, BACKLOG); | 71 addresses->GetAt(0)->addr(), port, BACKLOG); |
| 72 delete addresses; |
| 71 if (address < 0) { | 73 if (address < 0) { |
| 72 Log::PrintErr("Failed binding VmStats socket: %s:%d\n", host, port); | 74 Log::PrintErr("Failed binding VmStats socket: %s:%d\n", host, port); |
| 73 return; | 75 return; |
| 74 } | 76 } |
| 75 instance_->bind_address_ = address; | 77 instance_->bind_address_ = address; |
| 76 Log::Print("VmStats URL: http://%s:%"Pd"/\n", host, Socket::GetPort(address)); | 78 Log::Print("VmStats URL: http://%s:%"Pd"/\n", host, Socket::GetPort(address)); |
| 77 | 79 |
| 78 MonitorLocker ml(instance_monitor_); | 80 MonitorLocker ml(instance_monitor_); |
| 79 instance_->running_ = true; | 81 instance_->running_ = true; |
| 80 int err = dart::Thread::Start(WebServer, address); | 82 int err = dart::Thread::Start(WebServer, address); |
| (...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 472 if (result != NULL) { | 474 if (result != NULL) { |
| 473 return result; | 475 return result; |
| 474 } | 476 } |
| 475 plugin = plugin->next(); | 477 plugin = plugin->next(); |
| 476 } | 478 } |
| 477 return NULL; | 479 return NULL; |
| 478 } | 480 } |
| 479 | 481 |
| 480 } // namespace bin | 482 } // namespace bin |
| 481 } // namespace dart | 483 } // namespace dart |
| OLD | NEW |