Skip to content

Commit f934e39

Browse files
srawlinsCommit Queue
authored andcommitted
analyzer: Remove unnecessary Driver.httpServer
Change-Id: I504f7f2ebf01a1a5e963374f3c0b4a66c2ed9d1d Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/401383 Commit-Queue: Samuel Rawlins <[email protected]> Reviewed-by: Brian Wilkerson <[email protected]>
1 parent c5c3544 commit f934e39

File tree

1 file changed

+6
-19
lines changed

1 file changed

+6
-19
lines changed

pkg/analysis_server/lib/src/server/driver.dart

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,6 @@ class Driver implements ServerStarter {
143143
/// The instrumentation service that is to be used by the analysis server.
144144
InstrumentationService? instrumentationService;
145145

146-
HttpAnalysisServer? httpServer;
147-
148146
/// Use the given command-line [arguments] to start this server.
149147
///
150148
/// If [sendPort] is not null, assumes this is launched in an isolate and will
@@ -406,9 +404,8 @@ class Driver implements ServerStarter {
406404
analyticsManager,
407405
detachableFileSystemManager,
408406
);
409-
httpServer = HttpAnalysisServer(socketServer);
410407

411-
diagnosticServer.httpServer = httpServer!;
408+
diagnosticServer.httpServer = HttpAnalysisServer(socketServer);
412409
if (diagnosticServerPort != null) {
413410
diagnosticServer.startOnPort(diagnosticServerPort);
414411
}
@@ -440,18 +437,14 @@ class Driver implements ServerStarter {
440437
exitCode = await devServer.processDirectories([trainDirectory]);
441438
if (exitCode != 0) exit(exitCode);
442439

443-
var httpServer = this.httpServer;
444-
if (httpServer != null) {
445-
httpServer.close();
446-
}
440+
diagnosticServer.httpServer.close();
447441
await instrumentationService.shutdown();
448-
449442
unawaited(socketServer.analysisServer!.shutdown());
450443

451444
try {
452445
tempDriverDir.deleteSync(recursive: true);
453446
} catch (_) {
454-
// ignore any exception
447+
// Ignore any exception.
455448
}
456449

457450
exit(exitCode);
@@ -473,10 +466,7 @@ class Driver implements ServerStarter {
473466
errorNotifier.sendSilentExceptionsToClient = true;
474467
}
475468
serveResult.then((_) async {
476-
var httpServer = this.httpServer;
477-
if (httpServer != null) {
478-
httpServer.close();
479-
}
469+
diagnosticServer.httpServer.close();
480470
await instrumentationService.shutdown();
481471
unawaited(socketServer.analysisServer!.shutdown());
482472
if (sendPort == null) exit(0);
@@ -485,7 +475,7 @@ class Driver implements ServerStarter {
485475
print:
486476
results.flag(INTERNAL_PRINT_TO_CONSOLE)
487477
? null
488-
: httpServer!.recordPrint,
478+
: diagnosticServer.httpServer.recordPrint,
489479
);
490480
}
491481
}
@@ -518,8 +508,7 @@ class Driver implements ServerStarter {
518508
detachableFileSystemManager,
519509
);
520510
errorNotifier.server = socketServer.analysisServer;
521-
522-
diagnosticServer.httpServer = httpServer = HttpAnalysisServer(socketServer);
511+
diagnosticServer.httpServer = HttpAnalysisServer(socketServer);
523512

524513
if (diagnosticServerPort != null) {
525514
diagnosticServer.startOnPort(diagnosticServerPort);
@@ -948,8 +937,6 @@ class Driver implements ServerStarter {
948937
class _DiagnosticServerImpl extends DiagnosticServer {
949938
late HttpAnalysisServer httpServer;
950939

951-
_DiagnosticServerImpl();
952-
953940
@override
954941
Future<int> getServerPort() async => (await httpServer.serveHttp())!;
955942

0 commit comments

Comments
 (0)