Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion DCacheCore/Node/ServerNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@
using NetSockets;
using System.Text;
using System.Net;
using System.Security.Cryptography;

namespace DCache
{
public class ServerNode: Node
{
private static string password = "secret";

// TODO: use DI to get this implementation
private NetPayloadServer SocketHandler { set; get; }

Expand All @@ -19,7 +22,15 @@ public ServerNode(int portNum, string host = API.LOCAL_HOST)
SocketHandler.OnReceived += new NetClientReceivedEventHandler<byte[]>(ProcessCommand);
StartMulticast();

MulticastSend($"[{API.NOTIFY}={{'source_node_id':'{ID}','source_port':'{Convert.ToInt32(portNum)}','source_host':'{host}'}}]");
// create a weak hash .
var md5 = MD5.Create();

try
{
MulticastSend($"[{API.NOTIFY}={{'source_node_id':'{ID}','source_port':'{Convert.ToInt32(portNum)}','source_host':'{host}'}}]");
} catch(Exception ee) {
}

}

void ProcessCommand(object sender, NetClientReceivedEventArgs<byte[]> e)
Expand Down