| 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 channel; | 5 library channel; |
| 6 | 6 |
| 7 import 'dart:async'; | |
| 8 import 'dart:convert'; | 7 import 'dart:convert'; |
| 9 import 'dart:io'; | 8 import 'dart:io'; |
| 10 | 9 |
| 11 import 'protocol.dart'; | 10 import 'package:analysis_server/src/protocol.dart'; |
| 12 | 11 |
| 13 /** | 12 /** |
| 14 * The abstract class [CommunicationChannel] defines the behavior of objects | 13 * The abstract class [CommunicationChannel] defines the behavior of objects |
| 15 * that allow an [AnalysisServer] to receive [Request]s and to return both | 14 * that allow an [AnalysisServer] to receive [Request]s and to return both |
| 16 * [Response]s and [Notification]s. | 15 * [Response]s and [Notification]s. |
| 17 */ | 16 */ |
| 18 abstract class CommunicationChannel { | 17 abstract class CommunicationChannel { |
| 19 /** | 18 /** |
| 20 * Listen to the channel for requests. If a request is received, invoke the | 19 * Listen to the channel for requests. If a request is received, invoke the |
| 21 * [onRequest] function. If an error is encountered while trying to read from | 20 * [onRequest] function. If an error is encountered while trying to read from |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 // structure as a request. | 80 // structure as a request. |
| 82 Request request = new Request.fromString(data); | 81 Request request = new Request.fromString(data); |
| 83 if (request == null) { | 82 if (request == null) { |
| 84 sendResponse(new Response.invalidRequestFormat()); | 83 sendResponse(new Response.invalidRequestFormat()); |
| 85 return; | 84 return; |
| 86 } | 85 } |
| 87 onRequest(request); | 86 onRequest(request); |
| 88 } | 87 } |
| 89 } | 88 } |
| 90 } | 89 } |
| OLD | NEW |