Browse Source

minor changes

PascalCoin 6 years ago
parent
commit
47cc0409a1
3 changed files with 10 additions and 6 deletions
  1. 1 1
      src/core/UConst.pas
  2. 1 1
      src/core/UNetProtection.pas
  3. 8 4
      src/core/URPC.pas

+ 1 - 1
src/core/UConst.pas

@@ -108,7 +108,7 @@ Const
   CT_BlockChain_Protocol_Available: Word = 4; // Protocol 4 flag
   CT_BlockChain_Protocol_Available: Word = 4; // Protocol 4 flag
   CT_Protocol_Upgrade_v2_MinBlock = {$IFDEF PRODUCTION}115000{$ELSE}50{$ENDIF};
   CT_Protocol_Upgrade_v2_MinBlock = {$IFDEF PRODUCTION}115000{$ELSE}50{$ENDIF};
   CT_Protocol_Upgrade_v3_MinBlock = {$IFDEF PRODUCTION}210000{$ELSE}250{$ENDIF};
   CT_Protocol_Upgrade_v3_MinBlock = {$IFDEF PRODUCTION}210000{$ELSE}250{$ENDIF};
-  CT_Protocol_Upgrade_v4_MinBlock = {$IFDEF PRODUCTION}999999{$ELSE}400{$ENDIF}; // NOTE: Upgrade to V4 not decided!   TODO!
+  CT_Protocol_Upgrade_v4_MinBlock = {$IFDEF PRODUCTION}99999999{$ELSE}400{$ENDIF}; // NOTE: Upgrade to V4 not decided!   TODO!
 
 
 
 
   CT_MagicNetIdentification = {$IFDEF PRODUCTION}$0A043580{$ELSE}$04000000{$ENDIF}; // Unix timestamp 168048000 ... It's Albert birthdate!
   CT_MagicNetIdentification = {$IFDEF PRODUCTION}$0A043580{$ELSE}$04000000{$ENDIF}; // Unix timestamp 168048000 ... It's Albert birthdate!

+ 1 - 1
src/core/UNetProtection.pas

@@ -210,7 +210,7 @@ begin
   currts := UnivDateTimeToUnix( DateTime2UnivDateTime(now) );
   currts := UnivDateTimeToUnix( DateTime2UnivDateTime(now) );
   json := Lock(AIp,True);
   json := Lock(AIp,True);
   Try
   Try
-    arr := json.GetAsArray('diconnect');
+    arr := json.GetAsArray('disconnect');
     objinfo := arr.GetAsObject(arr.Count);
     objinfo := arr.GetAsObject(arr.Count);
     objinfo.GetAsVariant('updated_ts').Value := currts;
     objinfo.GetAsVariant('updated_ts').Value := currts;
     objinfo.GetAsVariant('reason').Value := AReason;
     objinfo.GetAsVariant('reason').Value := AReason;

+ 8 - 4
src/core/URPC.pas

@@ -870,6 +870,7 @@ function TRPCProcess.ProcessMethod(const method: String; params: TPCJSONObject;
     i : Integer;
     i : Integer;
     json, newJson : TPCJSONObject;
     json, newJson : TPCJSONObject;
     ipInfo : TIpInfo;
     ipInfo : TIpInfo;
+    aDisconnectedOnly : Boolean;
   begin
   begin
     aip := Trim(params.AsString('ip',''));
     aip := Trim(params.AsString('ip',''));
     if aip<>'' then begin
     if aip<>'' then begin
@@ -883,13 +884,16 @@ function TRPCProcess.ProcessMethod(const method: String; params: TPCJSONObject;
         TNetData.NetData.IpInfos.Unlock;
         TNetData.NetData.IpInfos.Unlock;
       End;
       End;
     end else begin
     end else begin
+      aDisconnectedOnly := params.AsBoolean('only-disconnected',False);
       for i :=0 to TNetData.NetData.IpInfos.Count-1 do begin
       for i :=0 to TNetData.NetData.IpInfos.Count-1 do begin
         ipInfo := TNetData.NetData.IpInfos.Lock(i);
         ipInfo := TNetData.NetData.IpInfos.Lock(i);
         Try
         Try
-          newJson := TPCJSONObject.Create;
-          newJson.GetAsVariant('ip').Value := ipInfo.ip;
-          newJson.GetAsObject('values').Assign(ipInfo.json);
-          GetResultArray.Insert(GetResultArray.Count,newJson);
+          if (Not aDisconnectedOnly) Or (Assigned(ipInfo.json.FindName('disconnect'))) then begin
+            newJson := TPCJSONObject.Create;
+            newJson.GetAsVariant('ip').Value := ipInfo.ip;
+            newJson.GetAsObject('values').Assign(ipInfo.json);
+            GetResultArray.Insert(GetResultArray.Count,newJson);
+          end;
         Finally
         Finally
           TNetData.NetData.IpInfos.Unlock;
           TNetData.NetData.IpInfos.Unlock;
         End;
         End;