internal WorkerPeer GetPeer(int id) { WorkerPeer peer = null; if (this.worker.Peers.TryGetValue(id, out peer)) { return(peer); } else { return(null); } }
internal WorkerPeer CreatePeer(CooperatingWorker cow) { var workerPeer = new WorkerPeer { Id = worker.GetNextTaskId(), TasksUrl = cow.TasksUrl, CapacityUrl = cow.CapacityUrl }; if (this.worker.Peers.TryAdd(workerPeer.Id, workerPeer)) { return(workerPeer); } else { return(null); } }