public List <Call> GetBatchesBehind(string peerID) { lock (_batch_lock) { if (!BatchesBehind.ContainsKey(peerID)) { return(new List <Call>()); } List <Call> behind = new List <Call>(); foreach (Call r in BatchesBehind[peerID].Values.ToList()) { behind.Add(r); int s = Params.BATCH_SIZE - 10; if (r.Type == Call._Type.DATA_REQUEST) { DataRequest a = Encoder.DecodeDataRequest(r.Data); s = (Params.BATCH_SIZE - 10) / a.PointDetails.Count; // if (s>8)s=8; } if (behind.Count >= s) { break; } } return(behind); } }
public void RemoveBatchBehind(string peerID, Call request) { lock (_batch_lock) { if (BatchesBehind.ContainsKey(peerID)) { BatchesBehind[peerID].Remove(request.ID); } } }
public int BatchesBehindCount(string peerID) { lock (_batch_lock) { if (!BatchesBehind.ContainsKey(peerID)) { return(0); } return(BatchesBehind[peerID].Values.Count); } }
public void AddToNodeBehind(string peerID, Call request) { lock (_batch_lock) { if (!BatchesBehind.ContainsKey(peerID)) { BatchesBehind.Add(peerID, new TDict <string, Call>()); } if (!BatchesBehind[peerID].ContainsKey(request.ID)) { BatchesBehind[peerID].Add(request.ID, request); } } }
public void ClearPeerLog(string peerID) { lock (_batch_lock) { if (BatchesBehind.ContainsKey(peerID)) { BatchesBehind.Remove(peerID); } } lock (_action_lock) { if (ActionsCompleted.ContainsKey(peerID)) { ActionsCompleted.Remove(peerID); } } }