Ejemplo n.º 1
0
        public static void AddMinerStudioSession(WsUserName wsUserName, UserData userData, IPEndPoint remoteEndPoint, IWsSessionAdapter session)
        {
            IMinerStudioSession minerSession = MinerStudioSession.Create(userData, wsUserName, remoteEndPoint, session.SessionId, WsServer.MinerStudioWsSessions);

            MinerStudioSessionSet.Add(minerSession);
            session.SendAsync(new WsMessage(Guid.NewGuid(), WsMessage.ServerTime)
            {
                Data = Timestamp.GetTimestamp()
            }.SignToBytes(userData.Password));
        }
Ejemplo n.º 2
0
        protected override void OnOpen()
        {
            base.OnOpen();
            if (!this.TryGetUser(out WsUserName wsUserName, out UserData userData))
            {
                this.CloseAsync();
                return;
            }
            IMinerStudioSession minerSession = MinerStudioSession.Create(userData, wsUserName, this.ID);

            WsRoot.MinerStudioSessionSet.Add(minerSession);
        }
Ejemplo n.º 3
0
        public static void AddMinerStudioSession(IWsSessionAdapter session)
        {
            if (!WsRoot.TryGetUser(session.AuthorizationBase64, out WsUserName wsUserName, out UserData userData, out string errMsg))
            {
                session.CloseAsync(WsCloseCode.Normal, errMsg);
                return;
            }
            IMinerStudioSession minerSession = MinerStudioSession.Create(userData, wsUserName, session.SessionId, WsRoot.WsServer.MinerStudioWsSessionsAdapter);

            WsRoot.MinerStudioSessionSet.Add(minerSession);
            session.SendAsync(new WsMessage(Guid.NewGuid(), WsMessage.ServerTime)
            {
                Data = Timestamp.GetTimestamp()
            }.SignToBytes(userData.Password));
        }
Ejemplo n.º 4
0
        protected override void OnOpen()
        {
            base.OnOpen();
            if (!this.TryGetUser(out WsUserName wsUserName, out UserData userData))
            {
                this.CloseAsync();
                return;
            }
            IMinerStudioSession minerSession = MinerStudioSession.Create(userData, wsUserName, this.ID, Sessions);

            WsRoot.MinerStudioSessionSet.Add(minerSession);
            base.SendAsync(new WsMessage(Guid.NewGuid(), WsMessage.ServerTime)
            {
                Data = Timestamp.GetTimestamp()
            }.SignToBytes(userData.Password), completed: null);
        }