2e843c4342
The session logger is the first half of the replay mechanism. It captures data in a log about all of the messages sent to and from the analysis server. The log player will then take such a log and replay the portions required in order to drive an analysis server. This first CL captures all of the communications except those with the plugin isolates. Adding support for the plugin isolates will require some additional refactoring that I thought would be easier to review if placed in a separate CL. Change-Id: I8f19abd3ebff83ac26584a9377922520857801d4 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/459341 Reviewed-by: Keerti Parthasarathy <keertip@google.com> Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
33 lines
1.3 KiB
Dart
33 lines
1.3 KiB
Dart
// Copyright (c) 2014, 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.
|
|
|
|
import 'package:analysis_server/src/channel/byte_stream_channel.dart';
|
|
import 'package:analysis_server/src/socket_server.dart';
|
|
|
|
/// Instances of the class [StdioAnalysisServer] implement a simple server
|
|
/// operating over standard input and output. The primary responsibility of this
|
|
/// server is to split incoming messages on newlines and pass them along to the
|
|
/// analysis server.
|
|
class StdioAnalysisServer {
|
|
/// An object that can handle either a WebSocket connection or a connection
|
|
/// to the client over stdio.
|
|
SocketServer socketServer;
|
|
|
|
/// Initialize a newly created stdio server.
|
|
StdioAnalysisServer(this.socketServer);
|
|
|
|
/// Begin serving requests over stdio.
|
|
///
|
|
/// Return a future that will be completed when stdin closes.
|
|
Future<void> serveStdio() {
|
|
var serverChannel = StdinStdoutLineStreamServerChannel(
|
|
socketServer.instrumentationService,
|
|
socketServer.sessionLogger,
|
|
requestStatistics: socketServer.requestStatistics,
|
|
);
|
|
socketServer.createAnalysisServer(serverChannel);
|
|
return serverChannel.closed;
|
|
}
|
|
}
|