Ejemplo n.º 1
0
 public Protocol(int?port, PeerAddress[] potential_peers, Chat.NewMessage new_msg_action)
 {
     r         = new Random();
     ID        = (ulong)(r.NextDouble() * ulong.MaxValue);
     com       = new Communications(port);
     messages  = new Messages();
     tlv_utils = new TLV_utils(ID);
     p         = new Peers(potential_peers, com, tlv_utils, messages);
     c         = new Chat(com, tlv_utils, messages, p, new_msg_action);
 }
Ejemplo n.º 2
0
 public Chat(Communications com, TLV_utils tlv_utils, Messages messages, Peers peers, NewMessage new_message_action)
 {
     r                       = new Random();
     this.com                = com;
     this.messages           = messages;
     this.tlv_utils          = tlv_utils;
     this.peers              = peers;
     this.new_message_action = new_message_action;
     recent_messages         = new Dictionary <MessageIdentifier, MessageFloodInfo>();
 }