public void PeerDownAlert(PeerIsDownMessage message)
 {
     if (OnRemotePeerIsDown != null)
     {
         OnRemotePeerIsDown(message);
     }
 }
        private void SomePeerIsDown(PeerIsDownMessage message)
        {
            //Update my Energy Consumers List
            var consumersToRemove = (from c in consumers
                                     where c.peerName == message.peerName
                                     select c).ToArray();

            foreach (var cons in consumersToRemove)
            {
                _enSold = _enSold - cons.energy;
                consumers.Remove(cons);
            }

            //Update my Energy Producers List
            var producersToRemove = (from p in producers
                                     where p.peerName == message.peerName
                                     select p).ToArray();

            foreach (var prod in producersToRemove)
            {
                _enBought = _enBought - prod.energy;
                producers.Remove(prod);
            }

            Connector.channel.updateEnergyStatus(MessageFactory.createUpdateStatusMessage(_resolverName, _name, _enSold, _enBought));
        }
Exemplo n.º 3
0
 private void RemotePeerIsDown(PeerIsDownMessage message)
 {
     updateRemoteConnectionsList(message.header.Sender, message.peerName);
     Connector.channel.peerDown(message);
 }