Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix android dns-sd subtype error, and fix manualcode code pair search… #15009

Merged
merged 6 commits into from
Feb 16, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,22 @@ public void publish(
String[] subTypes) {
NsdServiceInfo serviceInfo = new NsdServiceInfo();
serviceInfo.setServiceName(serviceName);
serviceInfo.setServiceType(type);

/**
* Note, subtypes registration is using an undocumented feature of android dns-sd
* service/mDNSResponder which MAY STOP WORKING in future Android versions. Here, set type =
* "${type},${subtypes1},${subtypes2},...", then subtypes1, subtypes2 etc are all registered to
* this dns-sd server, we can usd `dns-sd -B ${type},${subtypes}` or avahi-browse
* ${subtypes}._sub.${type} -r to browser it
*/
StringBuilder sb = new StringBuilder(type);
for (String subType : subTypes) {
sb.append(",").append(subType);
lazarkov marked this conversation as resolved.
Show resolved Hide resolved
}
serviceInfo.setServiceType(sb.toString());

serviceInfo.setPort(port);
Log.i(TAG, "publish serviceName=" + serviceName + " type=" + type + " port=" + port);
Log.i(TAG, "publish serviceName=" + serviceName + " type=" + sb.toString() + " port=" + port);
int cnt = Math.min(textEntriesDatas.length, textEntriesKeys.length);
for (int i = 0; i < cnt; i++) {
String value = new String(textEntriesDatas[i]);
Expand Down