Skip to content

Commit

Permalink
Code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
jdomnitz committed May 5, 2023
1 parent bd9992d commit d761d4d
Show file tree
Hide file tree
Showing 12 changed files with 75 additions and 122 deletions.
3 changes: 0 additions & 3 deletions Browser/Program.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
using Makaretu.Dns;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Browser
{
Expand Down
1 change: 0 additions & 1 deletion src/MulticastClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
using System.Net;
using System.Net.NetworkInformation;
using System.Net.Sockets;
using System.Runtime.InteropServices;
using System.Threading.Tasks;

namespace Makaretu.Dns
Expand Down
13 changes: 7 additions & 6 deletions src/MulticastService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ public class MulticastService : IResolver, IDisposable
/// <summary>
/// Recently sent messages.
/// </summary>
RecentMessages sentMessages = new RecentMessages();
readonly RecentMessages sentMessages = new RecentMessages();

/// <summary>
/// Recently received messages.
/// </summary>
RecentMessages receivedMessages = new RecentMessages();
readonly RecentMessages receivedMessages = new RecentMessages();

/// <summary>
/// The multicast client.
Expand All @@ -53,17 +53,17 @@ public class MulticastService : IResolver, IDisposable
/// <summary>
/// Use to send unicast IPv4 answers.
/// </summary>
UdpClient unicastClientIp4 = new UdpClient(AddressFamily.InterNetwork);
readonly UdpClient unicastClientIp4 = new UdpClient(AddressFamily.InterNetwork);

/// <summary>
/// Use to send unicast IPv6 answers.
/// </summary>
UdpClient unicastClientIp6 = new UdpClient(AddressFamily.InterNetworkV6);
readonly UdpClient unicastClientIp6 = new UdpClient(AddressFamily.InterNetworkV6);

/// <summary>
/// Function used for listening filtered network interfaces.
/// </summary>
Func<IEnumerable<NetworkInterface>, IEnumerable<NetworkInterface>> networkInterfacesFilter;
readonly Func<IEnumerable<NetworkInterface>, IEnumerable<NetworkInterface>> networkInterfacesFilter;

/// <summary>
/// Set the default TTLs.
Expand Down Expand Up @@ -343,7 +343,7 @@ void FindNetworkInterfaces()
}

/// <inheritdoc />
public Task<Message> ResolveAsync(Message request, CancellationToken cancel = default(CancellationToken))
public Task<Message> ResolveAsync(Message request, CancellationToken cancel = default)
{
var tsc = new TaskCompletionSource<Message>();

Expand Down Expand Up @@ -694,6 +694,7 @@ protected virtual void Dispose(bool disposing)
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}

#endregion
Expand Down
1 change: 0 additions & 1 deletion src/NetworkInterfaceEventArgs.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.Net.NetworkInformation;
using System.Text;

namespace Makaretu.Dns
{
Expand Down
2 changes: 0 additions & 2 deletions src/RecentMessages.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography;
using System.Text;

namespace Makaretu.Dns
{
Expand Down
5 changes: 2 additions & 3 deletions src/ServiceDiscovery.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Claims;
using System.Threading.Tasks;
using System.Xml.Linq;
using Common.Logging;
using Makaretu.Dns.Resolving;

Expand All @@ -30,7 +28,7 @@ public class ServiceDiscovery : IDisposable
public static readonly DomainName ServiceName = new DomainName("_services._dns-sd._udp.local");

readonly bool ownsMdns;
List<ServiceProfile> profiles = new List<ServiceProfile>();
readonly List<ServiceProfile> profiles = new List<ServiceProfile>();
bool conflict;

/// <summary>
Expand Down Expand Up @@ -504,6 +502,7 @@ protected virtual void Dispose(bool disposing)
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}

#endregion
Expand Down
7 changes: 1 addition & 6 deletions src/ServiceInstanceDiscoveryEventArgs.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
using Makaretu.Dns;
using System;
using System.Collections.Generic;
using System.Text;

namespace Makaretu.Dns
namespace Makaretu.Dns
{
/// <summary>
/// The event data for <see cref="ServiceDiscovery.ServiceInstanceDiscovered"/>.
Expand Down
7 changes: 1 addition & 6 deletions src/ServiceInstanceShutdownEventArgs.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
using Makaretu.Dns;
using System;
using System.Collections.Generic;
using System.Text;

namespace Makaretu.Dns
namespace Makaretu.Dns
{
/// <summary>
/// The event data for <see cref="ServiceDiscovery.ServiceInstanceShutdown"/>.
Expand Down
5 changes: 1 addition & 4 deletions src/ServiceProfile.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
using System;
using System.Collections.Generic;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Sockets;
using System.Text;

namespace Makaretu.Dns
{
Expand Down
5 changes: 0 additions & 5 deletions test/Logging.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
using Common.Logging;
using Makaretu.Mdns.Simple;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Makaretu.Mdns
{
Expand Down
2 changes: 0 additions & 2 deletions test/RecentMessagesTest.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.VisualStudio.TestTools.UnitTesting;

Expand Down
Loading

0 comments on commit d761d4d

Please sign in to comment.