| @@ -677,34 +677,38 @@ mDNSlocal void SetNextAnnounceProbeTime( | | | @@ -677,34 +677,38 @@ mDNSlocal void SetNextAnnounceProbeTime( |
677 | if (rr->resrec.RecordType == kDNSRecordTypeUnique) | | 677 | if (rr->resrec.RecordType == kDNSRecordTypeUnique) |
678 | { | | 678 | { |
679 | if ((rr->LastAPTime + rr->ThisAPInterval) - m->timenow > mDNSPlatformOneSecond * 10) | | 679 | if ((rr->LastAPTime + rr->ThisAPInterval) - m->timenow > mDNSPlatformOneSecond * 10) |
680 | { | | 680 | { |
681 | LogMsg("SetNextAnnounceProbeTime: ProbeCount %d Next in %d %s", rr->ProbeCount, (rr->LastAPTime + rr->ThisAPInterval) - m->timenow, ARDisplayString(m, rr)); | | 681 | LogMsg("SetNextAnnounceProbeTime: ProbeCount %d Next in %d %s", rr->ProbeCount, (rr->LastAPTime + rr->ThisAPInterval) - m->timenow, ARDisplayString(m, rr)); |
682 | LogMsg("SetNextAnnounceProbeTime: m->SuppressProbes %d m->timenow %d diff %d", m->SuppressProbes, m->timenow, m->SuppressProbes - m->timenow); | | 682 | LogMsg("SetNextAnnounceProbeTime: m->SuppressProbes %d m->timenow %d diff %d", m->SuppressProbes, m->timenow, m->SuppressProbes - m->timenow); |
683 | } | | 683 | } |
684 | if (m->NextScheduledProbe - (rr->LastAPTime + rr->ThisAPInterval) >= 0) | | 684 | if (m->NextScheduledProbe - (rr->LastAPTime + rr->ThisAPInterval) >= 0) |
685 | m->NextScheduledProbe = (rr->LastAPTime + rr->ThisAPInterval); | | 685 | m->NextScheduledProbe = (rr->LastAPTime + rr->ThisAPInterval); |
686 | // Some defensive code: | | 686 | // Some defensive code: |
687 | // If (rr->LastAPTime + rr->ThisAPInterval) happens to be far in the past, we don't want to allow | | 687 | // If (rr->LastAPTime + rr->ThisAPInterval) happens to be far in the past, we don't want to allow |
688 | // NextScheduledProbe to be set excessively in the past, because that can cause bad things to happen. | | 688 | // NextScheduledProbe to be set excessively in the past, because that can cause bad things to happen. |
689 | // See: <rdar://problem/7795434> mDNS: Sometimes advertising stops working and record interval is set to zero | | 689 | // See: <rdar://problem/7795434> mDNS: Sometimes advertising stops working and record interval is set to zero |
690 | if (m->NextScheduledProbe - m->timenow < 0) | | 690 | // A future time also needs to be set to avoid spamming logs about not all probes being sent. |
691 | m->NextScheduledProbe = m->timenow; | | 691 | if (m->NextScheduledProbe - m->timenow <= 0) |
| | | 692 | m->NextScheduledProbe = m->timenow + 1; |
692 | } | | 693 | } |
693 | else if (rr->AnnounceCount && (ResourceRecordIsValidAnswer(rr) || rr->resrec.RecordType == kDNSRecordTypeDeregistering)) | | 694 | else if (rr->AnnounceCount && (ResourceRecordIsValidAnswer(rr) || rr->resrec.RecordType == kDNSRecordTypeDeregistering)) |
694 | { | | 695 | { |
695 | if (m->NextScheduledResponse - (rr->LastAPTime + rr->ThisAPInterval) >= 0) | | 696 | if (m->NextScheduledResponse - (rr->LastAPTime + rr->ThisAPInterval) >= 0) |
696 | m->NextScheduledResponse = (rr->LastAPTime + rr->ThisAPInterval); | | 697 | m->NextScheduledResponse = (rr->LastAPTime + rr->ThisAPInterval); |
697 | } | | 698 | } |
| | | 699 | // A future time also needs to be set to avoid spamming logs about not all responses being sent. |
| | | 700 | if (m->NextScheduledResponse - m->timenow <= 0) |
| | | 701 | m->NextScheduledResponse = m->timenow + 1; |
698 | } | | 702 | } |
699 | | | 703 | |
700 | mDNSlocal void InitializeLastAPTime(mDNS *const m, AuthRecord *const rr) | | 704 | mDNSlocal void InitializeLastAPTime(mDNS *const m, AuthRecord *const rr) |
701 | { | | 705 | { |
702 | // For reverse-mapping Sleep Proxy PTR records, probe interval is one second | | 706 | // For reverse-mapping Sleep Proxy PTR records, probe interval is one second |
703 | rr->ThisAPInterval = rr->AddressProxy.type ? mDNSPlatformOneSecond : DefaultAPIntervalForRecordType(rr->resrec.RecordType); | | 707 | rr->ThisAPInterval = rr->AddressProxy.type ? mDNSPlatformOneSecond : DefaultAPIntervalForRecordType(rr->resrec.RecordType); |
704 | | | 708 | |
705 | // * If this is a record type that's going to probe, then we use the m->SuppressProbes time. | | 709 | // * If this is a record type that's going to probe, then we use the m->SuppressProbes time. |
706 | // * Otherwise, if it's not going to probe, but m->SuppressProbes is set because we have other | | 710 | // * Otherwise, if it's not going to probe, but m->SuppressProbes is set because we have other |
707 | // records that are going to probe, then we delay its first announcement so that it will | | 711 | // records that are going to probe, then we delay its first announcement so that it will |
708 | // go out synchronized with the first announcement for the other records that *are* probing. | | 712 | // go out synchronized with the first announcement for the other records that *are* probing. |
709 | // This is a minor performance tweak that helps keep groups of related records synchronized together. | | 713 | // This is a minor performance tweak that helps keep groups of related records synchronized together. |
710 | // The addition of "interval / 2" is to make sure that, in the event that any of the probes are | | 714 | // The addition of "interval / 2" is to make sure that, in the event that any of the probes are |