Ejemplo n.º 1
0
        public override void Process(IClientContextForState context, Common.Net.CRLFSocket socket)
        {
            IPeerStateForClient peerState = context.PeerState;

            string[] datas = { peerState.PeerId.ToString(), peerState.Connections.ToString() };
            socket.WriteLine("123 1 " + string.Join(":", datas));
        }
Ejemplo n.º 2
0
        public override void Process(IClientContextForState context, CRLFSocket socket)
        {
            IPeerStateForClient peerState = context.PeerState;

            string[] datas = { peerState.PeerId.ToString(), (peerState.Key == null ? "Unknown" : peerState.Key.PublicKey) };

            socket.WriteLine("128 1 " + string.Join(":", datas));
        }
Ejemplo n.º 3
0
        public override void Process(IClientContextForState context, CRLFSocket socket)
        {
            IPeerStateForClient peerState = context.PeerState;

            string[] datas = { peerState.PeerId.ToString(), context.PeerConfig.Port.ToString(), context.PeerConfig.FormattedAreaCode, peerState.Connections.ToString(), context.PeerConfig.MaxConnections.ToString() };

            socket.WriteLine("116 1 " + string.Join(":", datas));
        }
Ejemplo n.º 4
0
        public override void AcceptedEcho(IClientContextForState context, Common.Net.CRLFSocket socket, Common.Net.Packet packet)
        {
            IPeerStateForClient peerState = context.PeerState;

            if (peerState.Key == null || peerState.Key.IsExpired(context.PeerState.CalcNowProtocolTime()))
            {
                context.State = new RequireReallocateKeyState();
            }
            else
            {
                // TODO: 接続数増加のしきい値が固定値になっている
                if (peerState.Connections <= 2)
                {
                    context.State = new RequirePeerDataState(General.ClientConst.ProcessType.Maintain);
                }
                else
                {
                    context.State = new RequireProtocolTimeState();
                }
            }
        }