Exemplo n.º 1
0
        public MessageListener(TPeer manager, PeerMessageList <TPeer> messages, ManualLogSource log, IListenerEvents events)
        {
            _manager  = manager;
            _messages = messages;
            _log      = log;
            _events   = events;

            _peers = new Dictionary <NetPeer, Peer>();
        }
Exemplo n.º 2
0
        internal H3Server(ManualLogSource log, HostConfig config, RandomNumberGenerator rng, PeerMessageList <H3Server> messages, byte channelsCount, Version version, double tickDeltaTime, IPEndPoint publicEndPoint)
            : base(log, messages, channelsCount, new Events(messages.Definitions[typeof(Timestamped <PingMessage>)]), version, config.Binding.IPv4.Value, config.Binding.IPv6.Value, config.Binding.Port.Value)
        {
            _log     = log;
            _config  = config;
            _partyID = Key32.FromRandom(rng);

            _tickTimer = new LoopTimer(tickDeltaTime);
            _peerIDs   = new Dictionary <Peer, byte>();
            _husks     = new Dictionary <byte, Husk>();

            _selfID = -1;

            Secret  = new JoinSecret(version, publicEndPoint, Key32.FromRandom(rng), tickDeltaTime);
            HostKey = Key32.FromRandom(rng);
        }
Exemplo n.º 3
0
        internal H3Client(ManualLogSource log, ClientConfig config, StatefulActivity discord, PeerMessageList <H3Client> messages, byte channelsCount, double tickDeltaTime, Version version, IPEndPoint endpoint, ConnectionRequestMessage request, OnH3ClientDisconnect onDisconnected)
            : base(log, messages, channelsCount, new Events(), version, endpoint, x => x.Put(request))
        {
            _log            = log;
            _config         = config;
            _discord        = discord;
            _onDisconnected = onDisconnected;

            _tickDeltaTime = tickDeltaTime;
            _tickTimer     = new LoopTimer(tickDeltaTime);

            _players = new Dictionary <byte, Puppet>();
            _items   = new Dictionary <byte, Item>();
            _health  = new HealthInfo(HEALTH_INTERVAL, (int)(HEALTH_INTERVAL / PING_INTERVAL));
        }