aboutsummaryrefslogtreecommitdiff
path: root/RSSDP
diff options
context:
space:
mode:
authorBaronGreenback <jimcartlidge@yahoo.co.uk>2020-06-24 14:31:17 +0100
committerBaronGreenback <jimcartlidge@yahoo.co.uk>2020-06-24 14:31:17 +0100
commit5b0c1829084b8f54cd5356880d82b75723badf81 (patch)
treeedb6470b950b1f8a1eab55e0a71e7bb86baf5d11 /RSSDP
parent2486e480976d836e9b65c9bd986a0661c3c0229b (diff)
Added logging and broadcast = true
Not intended for merge into the fork.
Diffstat (limited to 'RSSDP')
-rw-r--r--RSSDP/SsdpCommunicationsServer.cs14
1 files changed, 9 insertions, 5 deletions
diff --git a/RSSDP/SsdpCommunicationsServer.cs b/RSSDP/SsdpCommunicationsServer.cs
index 8fde700e0..34b67a945 100644
--- a/RSSDP/SsdpCommunicationsServer.cs
+++ b/RSSDP/SsdpCommunicationsServer.cs
@@ -338,9 +338,12 @@ namespace Rssdp.Infrastructure
private ISocket ListenForBroadcastsAsync()
{
- var socket = _SocketFactory.CreateUdpMulticastSocket(SsdpConstants.MulticastLocalAdminAddress, _MulticastTtl, SsdpConstants.MulticastPort);
+ var socket = _SocketFactory.CreateUdpMulticastSocket(SsdpConstants.MulticastLocalAdminAddress, _MulticastTtl, SsdpConstants.MulticastPort, _logger);
- _ = ListenToSocketInternal(socket);
+ // TODO: remove this try and logging - testing purposes only.
+ _logger.LogError("Socket Created.");
+
+ _ = ListenToSocketInternal(socket, _logger);
return socket;
}
@@ -374,16 +377,16 @@ namespace Rssdp.Infrastructure
foreach (var socket in sockets)
{
- _ = ListenToSocketInternal(socket);
+ _ = ListenToSocketInternal(socket, _logger);
}
return sockets;
}
- private async Task ListenToSocketInternal(ISocket socket)
+ private async Task ListenToSocketInternal(ISocket socket, ILogger logger)
{
var cancelled = false;
- var receiveBuffer = new byte[8192];
+ var receiveBuffer = new byte[8192];
while (!cancelled && !IsDisposed)
{
@@ -393,6 +396,7 @@ namespace Rssdp.Infrastructure
if (result.ReceivedBytes > 0)
{
+ _logger.LogError("processing...");
// Strange cannot convert compiler error here if I don't explicitly
// assign or cast to Action first. Assignment is easier to read,
// so went with that.