@@ -23,12 +23,12 @@ public class MeaModDiscovery : IDiscovery
2323
2424 public void Dispose ( )
2525 {
26- if ( _discovery != null )
27- {
28- foreach ( var profile in _profiles . Keys . ToArray ( ) )
29- Unadvertise ( profile ) ;
30-
31- _discovery . Dispose ( ) ;
26+ if ( _discovery != null )
27+ {
28+ foreach ( var profile in _profiles . Keys . ToArray ( ) )
29+ Unadvertise ( profile ) ;
30+
31+ _discovery . Dispose ( ) ;
3232 }
3333 _mdns ? . Stop ( ) ;
3434 }
@@ -63,8 +63,8 @@ public void RefreshServices()
6363 public event Action < OSCQueryServiceProfile > OnOscServiceAdded ;
6464 public event Action < OSCQueryServiceProfile > OnOscQueryServiceAdded ;
6565 public event Action < string > OnOscServiceRemoved ;
66- public event Action < string > OnOscQueryServiceRemoved ;
67-
66+ public event Action < string > OnOscQueryServiceRemoved ;
67+
6868 private Dictionary < OSCQueryServiceProfile , ServiceProfile > _profiles = new Dictionary < OSCQueryServiceProfile , ServiceProfile > ( ) ;
6969 public void Advertise ( OSCQueryServiceProfile profile )
7070 {
@@ -107,12 +107,12 @@ private void OnRemoteServiceInfo(object sender, MessageEventArgs eventArgs)
107107 {
108108 try
109109 {
110- foreach ( SRVRecord record in response . AdditionalRecords . OfType < SRVRecord > ( ) )
110+ foreach ( SRVRecord record in response . AdditionalRecords . OfType < SRVRecord > ( ) . Concat ( response . Answers . OfType < SRVRecord > ( ) ) )
111111 {
112112 if ( record . TTL == TimeSpan . Zero )
113- RemoveMatchedService ( record ) ;
114- else
115- AddMatchedService ( response , record ) ;
113+ RemoveMatchedService ( record ) ;
114+ else
115+ AddMatchedService ( response , record ) ;
116116 }
117117 }
118118 catch ( Exception )
@@ -136,7 +136,7 @@ private void AddMatchedService(Message response, SRVRecord srvRecord)
136136 var instanceName = domainName [ 0 ] ;
137137
138138 var serviceName = string . Join ( "." , domainName . Skip ( 1 ) ) ;
139- var ips = response . AdditionalRecords . OfType < ARecord > ( ) . Select ( r => r . Address ) ;
139+ var ips = response . AdditionalRecords . OfType < ARecord > ( ) . Concat ( response . Answers . OfType < ARecord > ( ) ) . Select ( r => r . Address ) ;
140140
141141 var ipAddressList = ips . ToList ( ) ;
142142 var profile = new ServiceProfile ( instanceName , serviceName , srvRecord . Port , ipAddressList ) ;
@@ -165,8 +165,8 @@ private void AddMatchedService(Message response, SRVRecord srvRecord)
165165 }
166166 }
167167
168- private void RemoveMatchedService ( SRVRecord srvRecord )
169- {
168+ private void RemoveMatchedService ( SRVRecord srvRecord )
169+ {
170170 var domainName = srvRecord . Name . Labels ;
171171 var instanceName = domainName [ 0 ] ;
172172 var serviceName = string . Join ( "." , domainName . Skip ( 1 ) ) ;
0 commit comments