@@ -37,12 +37,12 @@ public HashSet<OSCQueryServiceProfile> GetOSCServices()
3737
3838 public void Dispose ( )
3939 {
40- if ( _discovery != null )
41- {
42- foreach ( var profile in _profiles . Keys . ToArray ( ) )
43- Unadvertise ( profile ) ;
44-
45- _discovery . Dispose ( ) ;
40+ if ( _discovery != null )
41+ {
42+ foreach ( var profile in _profiles . Keys . ToArray ( ) )
43+ Unadvertise ( profile ) ;
44+
45+ _discovery . Dispose ( ) ;
4646 }
4747 _mdns ? . Stop ( ) ;
4848 }
@@ -77,8 +77,8 @@ public void RefreshServices()
7777 public event Action < OSCQueryServiceProfile > OnOscServiceAdded ;
7878 public event Action < OSCQueryServiceProfile > OnOscQueryServiceAdded ;
7979 public event Action < string > OnOscServiceRemoved ;
80- public event Action < string > OnOscQueryServiceRemoved ;
81-
80+ public event Action < string > OnOscQueryServiceRemoved ;
81+
8282 private Dictionary < OSCQueryServiceProfile , ServiceProfile > _profiles = new Dictionary < OSCQueryServiceProfile , ServiceProfile > ( ) ;
8383 public void Advertise ( OSCQueryServiceProfile profile )
8484 {
@@ -121,12 +121,12 @@ private void OnRemoteServiceInfo(object sender, MessageEventArgs eventArgs)
121121 {
122122 try
123123 {
124- foreach ( SRVRecord record in response . AdditionalRecords . OfType < SRVRecord > ( ) )
124+ foreach ( SRVRecord record in response . AdditionalRecords . OfType < SRVRecord > ( ) . Concat ( response . Answers . OfType < SRVRecord > ( ) ) )
125125 {
126126 if ( record . TTL == TimeSpan . Zero )
127- RemoveMatchedService ( record ) ;
128- else
129- AddMatchedService ( response , record ) ;
127+ RemoveMatchedService ( record ) ;
128+ else
129+ AddMatchedService ( response , record ) ;
130130 }
131131 }
132132 catch ( Exception )
@@ -150,7 +150,7 @@ private void AddMatchedService(Message response, SRVRecord srvRecord)
150150 var instanceName = domainName [ 0 ] ;
151151
152152 var serviceName = string . Join ( "." , domainName . Skip ( 1 ) ) ;
153- var ips = response . AdditionalRecords . OfType < ARecord > ( ) . Select ( r => r . Address ) ;
153+ var ips = response . AdditionalRecords . OfType < ARecord > ( ) . Concat ( response . Answers . OfType < ARecord > ( ) ) . Select ( r => r . Address ) ;
154154
155155 var ipAddressList = ips . ToList ( ) ;
156156 var profile = new ServiceProfile ( instanceName , serviceName , srvRecord . Port , ipAddressList ) ;
@@ -193,8 +193,8 @@ private void AddMatchedService(Message response, SRVRecord srvRecord)
193193 }
194194 }
195195
196- private void RemoveMatchedService ( SRVRecord srvRecord )
197- {
196+ private void RemoveMatchedService ( SRVRecord srvRecord )
197+ {
198198 var domainName = srvRecord . Name . Labels ;
199199 var instanceName = domainName [ 0 ] ;
200200 var serviceName = string . Join ( "." , domainName . Skip ( 1 ) ) ;
0 commit comments