Ejemplo n.º 1
0
        public DEditorStatsResponse CollectStats(DEditorStatsRequest req)
        {
            var res = default(DEditorStatsResponse);

            res.NumClusteredBadges = 0;
            res.ListOfClusterIds   = new int[_clusters.Values.Count()];

            //record clusters
            int i = 0;

            foreach (var cluster in _clusters.Values)
            {
                res.NumClusteredBadges   += cluster.GetClusterables().Count();
                res.ListOfClusterIds[i++] = cluster.GetId();
            }

            //record links
            res.ListOfLinkIds = new int[_forwardEdges.Count()];
            i = 0;
            foreach (var edge in _forwardEdges.Values)
            {
                res.ListOfLinkIds[i++] = edge.linkShapeId;
            }

            res.NumClusters = _clusters.Count();

            res.NumLinks = _forwardEdges.Count();

            return(res);
        }
Ejemplo n.º 2
0
        public void SendDEditorRequest(int topicId)
        {
            if (peer == null || peer.PeerState != PeerStateValue.Connected)
            {
                return;
            }

            peer.OpCustom((byte)DiscussionOpCode.DEditorReport,
                          DEditorStatsRequest.Write(topicId),
                          true);
        }
Ejemplo n.º 3
0
        public void HandleDEditorStatsRequest(LitePeer peer,
                                              OperationRequest operationRequest,
                                              SendParameters sendParameters)
        {
            var req  = DEditorStatsRequest.Read(operationRequest.Parameters);
            var resp = _topology.CollectStats(req);

            resp.TopicId = req.topicId;

            //operation response has bug and doesn't send response. use event instead
            _room.Broadcast(peer,
                            resp.ToDict(),
                            sendParameters,
                            (byte)DiscussionEventCode.DEditorReportEvent,
                            BroadcastTo.RoomAll);
        }