Exemplo n.º 1
0
 private async void FireBroadCast(PeerConnection peer, Task queuedTask)
 {
     try
     {
         //TODO: Rebroadcast when implement limited connected peers
         //Send transaction only to other peers
         //if (string.Compare(peer.Key, _peerUrl, StringComparison.InvariantCultureIgnoreCase) != 0)
         {
             await queuedTask;
         }
     }
     catch (Exception e)
     {
         await PeerConnectionError(peer, e);
     }
 }
Exemplo n.º 2
0
        private async Task <PeerConnection> RegisterPeerAsync(string url)
        {
            var client = _networkClientFactory.Create(url);
            await client.CheckAccessAsync();

            var address        = client.Host.AbsoluteUri;
            var peerConnection = new PeerConnection(client);

            if (_peers.TryAdd(address, peerConnection))
            {
                _feedback.NewPeer(address);
                peerConnection.Accessible = true;
                return(peerConnection);
            }

            return(null);
        }