예제 #1
0
 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);
     }
 }
예제 #2
0
 public void RemoveBatchBehind(string peerID, Call request)
 {
     lock (_batch_lock)
     {
         if (BatchesBehind.ContainsKey(peerID))
         {
             BatchesBehind[peerID].Remove(request.ID);
         }
     }
 }
예제 #3
0
 public int BatchesBehindCount(string peerID)
 {
     lock (_batch_lock)
     {
         if (!BatchesBehind.ContainsKey(peerID))
         {
             return(0);
         }
         return(BatchesBehind[peerID].Values.Count);
     }
 }
예제 #4
0
 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);
         }
     }
 }
예제 #5
0
 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);
         }
     }
 }