Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(129)

Side by Side Diff: pkg/mdns/lib/src/lookup_resolver.dart

Issue 1413713011: Revert "Extend the mDNS package with a native extension used on Mac OS" (Closed) Base URL: git@github.com:dart-lang/fletch.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « pkg/mdns/lib/src/constants.dart ('k') | pkg/mdns/lib/src/native_extension_client.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2015, the Fletch project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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.md file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library mdns.src.lookup_resolver; 5 library mdns.src.lookup_resolver;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:collection'; 8 import 'dart:collection';
9 9
10 import 'package:mdns/src/packet.dart'; 10 import 'package:mdns/src/packet.dart';
11 11
12 class PendingRequest extends LinkedListEntry { 12 class PendingRequest extends LinkedListEntry {
13 final String hostname; 13 final String hostname;
(...skipping 13 matching lines...) Expand all
27 var request = new PendingRequest(hostname, completer); 27 var request = new PendingRequest(hostname, completer);
28 pendingRequests.add(request); 28 pendingRequests.add(request);
29 return completer.future.timeout(timeout, onTimeout: () { 29 return completer.future.timeout(timeout, onTimeout: () {
30 request.unlink(); 30 request.unlink();
31 return null; 31 return null;
32 }); 32 });
33 } 33 }
34 34
35 void handleResponse(List<DecodeResult> response) { 35 void handleResponse(List<DecodeResult> response) {
36 for (var r in response) { 36 for (var r in response) {
37 var name = r.name.toLowerCase();
38 if (name.endsWith('.')) name = name.substring(0, name.length - 1);
39 pendingRequests 37 pendingRequests
40 .where((pendingRequest) { 38 .where((pendingRequest) => pendingRequest.hostname == r.name)
41 return pendingRequest.hostname.toLowerCase() == name;
42 })
43 .forEach((pendingRequest) { 39 .forEach((pendingRequest) {
44 pendingRequest.completer.complete(r.address); 40 pendingRequest.completer.complete(r.address);
45 pendingRequest.unlink(); 41 pendingRequest.unlink();
46 }); 42 });
47 } 43 }
48 } 44 }
49 } 45 }
46
OLDNEW
« no previous file with comments | « pkg/mdns/lib/src/constants.dart ('k') | pkg/mdns/lib/src/native_extension_client.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698