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

Unified Diff: src/pkg/mdns/mdns_extension.cc

Issue 1411063006: Update the mDNS native extension for Mac OS to handle PTR and SRV records (Closed) Base URL: git@github.com:dart-lang/fletch.git@master
Patch Set: Addressed review comments 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/pkg/mdns/mdns_extension.h ('k') | src/pkg/mdns/mdns_extension_macos.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/pkg/mdns/mdns_extension.cc
diff --git a/src/pkg/mdns/mdns_extension.cc b/src/pkg/mdns/mdns_extension.cc
index 72a70a33984551e55960321ec2791b90a81b7b2a..d6818de5e0c871dd8c7171f6f5e3fa103a9fb545 100644
--- a/src/pkg/mdns/mdns_extension.cc
+++ b/src/pkg/mdns/mdns_extension.cc
@@ -19,31 +19,40 @@ void HandleRequest(Dart_Port port_id, Dart_CObject* message) {
// [1]: request type
// [2]: request argument
if (message->type == Dart_CObject_kArray &&
- message->value.as_array.length == 3) {
+ message->value.as_array.length > 2) {
Dart_CObject* reply_port = message->value.as_array.values[0];
Dart_CObject* request_type = message->value.as_array.values[1];
- Dart_CObject* argument = message->value.as_array.values[2];
- if (reply_port->type == Dart_CObject_kSendPort) {
- if (request_type->type == Dart_CObject_kInt32) {
- switch (request_type->value.as_int32) {
- case kEchoRequest:
+ if (reply_port->type == Dart_CObject_kSendPort &&
+ request_type->type == Dart_CObject_kInt32) {
+ switch (request_type->value.as_int32) {
+ case kEchoRequest:
+ if (message->value.as_array.length == 3) {
+ Dart_CObject* argument = message->value.as_array.values[2];
HandleEcho(reply_port->value.as_send_port.id, argument);
return;
-
- case kLookupRequest:
- HandleLookup(reply_port->value.as_send_port.id,
- argument->value.as_string);
+ }
+
+ case kLookupRequest:
+ if (message->value.as_array.length == 4) {
+ Dart_CObject* type = message->value.as_array.values[2];
+ Dart_CObject* name = message->value.as_array.values[3];
+ if (type->type == Dart_CObject_kInt32 &&
+ name->type == Dart_CObject_kString) {
+ HandleLookup(reply_port->value.as_send_port.id,
+ type->value.as_int32,
+ name->value.as_string);
+ }
return;
+ }
- default:
- break;
- // Ignore invalid requests.
- }
+ default:
+ break;
+ // Ignore invalid requests.
}
- Dart_CObject result;
- result.type = Dart_CObject_kNull;
- Dart_PostCObject(reply_port->value.as_send_port.id, &result);
}
+ Dart_CObject result;
+ result.type = Dart_CObject_kNull;
+ Dart_PostCObject(reply_port->value.as_send_port.id, &result);
}
}
« no previous file with comments | « src/pkg/mdns/mdns_extension.h ('k') | src/pkg/mdns/mdns_extension_macos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698