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; }); }
public void Broadcast(String dst, ClusterPacket packet) { Broadcast(new Channel.Path(dst), packet); }
public void Broadcast(Channel.Path dst, ClusterPacket packet) { }