Example #1
0
        public Task<ClusterPacket> Send(int dst, ClusterPacket packet)
        {
            var peer = peers[dst];

            if (!peer.isActive)
                throw new InvalidOperationException("peer is not active");

            var id = dispenser.next;
            var requestInfo = new RequestInfo();
            requestInfo.requestId = id;
            requestInfo.sentAt = Environment.TickCount;
            pendings[id] = requestInfo;
            packet.requestId = id;
            peer.session.Send(packet);

            return new Task<ClusterPacket>(()=>
            {
                return requestInfo.response;
            });
        }
Example #2
0
 public void Broadcast(String dst, ClusterPacket packet)
 {
     Broadcast(new Channel.Path(dst), packet);
 }
Example #3
0
        public void Broadcast(Channel.Path dst, ClusterPacket packet)
        {

        }