| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 library socket.server; | 5 library socket.server; |
| 6 | 6 |
| 7 import 'package:analysis_server/src/analysis_server.dart'; | 7 import 'package:analysis_server/src/analysis_server.dart'; |
| 8 import 'package:analysis_server/src/channel.dart'; | 8 import 'package:analysis_server/src/channel.dart'; |
| 9 import 'package:analysis_server/src/domain_context.dart'; | 9 import 'package:analysis_server/src/domain_context.dart'; |
| 10 import 'package:analysis_server/src/domain_server.dart'; | 10 import 'package:analysis_server/src/domain_server.dart'; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 * connection, or `null` if no such connection has yet been established. | 22 * connection, or `null` if no such connection has yet been established. |
| 23 */ | 23 */ |
| 24 AnalysisServer analysisServer; | 24 AnalysisServer analysisServer; |
| 25 | 25 |
| 26 /** | 26 /** |
| 27 * Create an analysis server which will communicate with the client using the | 27 * Create an analysis server which will communicate with the client using the |
| 28 * given serverChannel. | 28 * given serverChannel. |
| 29 */ | 29 */ |
| 30 void createAnalysisServer(ServerCommunicationChannel serverChannel) { | 30 void createAnalysisServer(ServerCommunicationChannel serverChannel) { |
| 31 if (analysisServer != null) { | 31 if (analysisServer != null) { |
| 32 var error = new RequestError.serverAlreadyStarted(); | 32 RequestError error = new RequestError.serverAlreadyStarted(); |
| 33 serverChannel.sendResponse(new Response('', error)); | 33 serverChannel.sendResponse(new Response('', error)); |
| 34 serverChannel.listen((Request request) { | 34 serverChannel.listen((Request request) { |
| 35 serverChannel.sendResponse(new Response(request.id, error)); | 35 serverChannel.sendResponse(new Response(request.id, error)); |
| 36 }); | 36 }); |
| 37 return; | 37 return; |
| 38 } | 38 } |
| 39 analysisServer = new AnalysisServer(serverChannel); | 39 analysisServer = new AnalysisServer(serverChannel); |
| 40 _initializeHandlers(analysisServer); | 40 _initializeHandlers(analysisServer); |
| 41 } | 41 } |
| 42 | 42 |
| 43 /** | 43 /** |
| 44 * Initialize the handlers to be used by the given [server]. | 44 * Initialize the handlers to be used by the given [server]. |
| 45 */ | 45 */ |
| 46 void _initializeHandlers(AnalysisServer server) { | 46 void _initializeHandlers(AnalysisServer server) { |
| 47 server.handlers = [ | 47 server.handlers = [ |
| 48 new ServerDomainHandler(server), | 48 new ServerDomainHandler(server), |
| 49 new ContextDomainHandler(server), | 49 new ContextDomainHandler(server), |
| 50 ]; | 50 ]; |
| 51 } | 51 } |
| 52 | 52 |
| 53 } | 53 } |
| OLD | NEW |