Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#146 Bug when DNSRecord.Service is evaluated before DNSRecord.TXT

pending-fixed
Pierre Frisch
None
5
2013-01-24
2013-01-22
Talksinmath
No

Hi,

after a couple of hours I found a bug that's been haunting me.
Under certain cirumstances, I would get a callback for a resolved service, but I would not get the TXT-Record that I was announcing (on another computer).
A Bonjour-broweser by Apple could see the TXT-Record.

I found that in this case, the DNSRecord.Text was evaluated in the JmDNS-Stack after the DNSRecord.Service answer.

During the evaluation of the DNSRecord.Service, the ServiceInfoImpl object was constructed with the text-bytes being set by the service-name:

DNSRecord, line 811-814
@Override
public ServiceInfo getServiceInfo(boolean persistent) {
return new ServiceInfoImpl(this.getQualifiedNameMap(), _port, _weight, _priority, persistent, _server);
}

This was leading to an entry in the DNS-Cache for the textByte, which then lead to unparsable properties and therefore an empty Text-Record.

At least this is my reasoning.

My proposed fix for this would be

@Override
public ServiceInfo getServiceInfo(boolean persistent) {
return new ServiceInfoImpl(this.getQualifiedNameMap(), _port, _weight, _priority, persistent, (byte[]) null);
}

This leads to an empty text-record for the Service answer and allows the Text answer to add its info to the DNSCache.

It seems to work, and all tests pass.

Is my thinking correct or did we make some mistakes ?

Thanks!
Carsten

Discussion

  • Pierre Frisch
    Pierre Frisch
    2013-01-24

    • assigned_to: nobody --> spearway
    • status: open --> pending-fixed
     
  • Pierre Frisch
    Pierre Frisch
    2013-01-24

    I completely agree with you. There is no reason to put that service string in the txt bytes. I cannot see any case where that would be the right answer.

    Integrated in TOT

    Pierre