dart-sdk/runtime/bin/vmservice_impl.h
Ben Konyi d11e89f516 [ Service ] Wait for DDS connection before outputting service connection
information

When dartdev and the VM service are enabled, the service should avoid
advertising its connection information until after DDS has connected in
order to prevent race conditions between DDS and external clients.

Fixes https://github.com/dart-lang/sdk/issues/42727

Change-Id: If6393f085e9147af628997a1f8936e84f9d8310c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/157462
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2020-08-20 19:00:59 +00:00

52 lines
1.5 KiB
C++

// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
#ifndef RUNTIME_BIN_VMSERVICE_IMPL_H_
#define RUNTIME_BIN_VMSERVICE_IMPL_H_
#include "include/dart_api.h"
#include "platform/globals.h"
namespace dart {
namespace bin {
class VmService {
public:
static bool Setup(const char* server_ip,
intptr_t server_port,
bool dev_mode_server,
bool auth_codes_disabled,
const char* write_service_info_filename,
bool trace_loading,
bool deterministic,
bool enable_service_port_fallback,
bool wait_for_dds_to_advertise_service);
static void SetNativeResolver();
// Error message if startup failed.
static const char* GetErrorMessage();
// HTTP Server's address.
static const char* GetServerAddress() { return &server_uri_[0]; }
private:
static const intptr_t kServerUriStringBufferSize = 1024;
friend void NotifyServerState(Dart_NativeArguments args);
static void SetServerAddress(const char* server_uri_);
static const char* error_msg_;
static char server_uri_[kServerUriStringBufferSize];
DISALLOW_ALLOCATION();
DISALLOW_IMPLICIT_CONSTRUCTORS(VmService);
};
} // namespace bin
} // namespace dart
#endif // RUNTIME_BIN_VMSERVICE_IMPL_H_