|
@@ -66,77 +66,73 @@ Var i : integer;
|
|
|
strings, sNSC, sRS, sDisc : TStrings;
|
|
|
hh,nn,ss,ms : Word;
|
|
|
begin
|
|
|
- Try
|
|
|
- if Not TNetData.NetData.NetConnections.TryLockList(100,l) then exit;
|
|
|
- try
|
|
|
- strings := memoNetConnections.Lines;
|
|
|
- sNSC := TStringList.Create;
|
|
|
- sRS := TStringList.Create;
|
|
|
- sDisc := TStringList.Create;
|
|
|
- strings.BeginUpdate;
|
|
|
- Try
|
|
|
- for i := 0 to l.Count - 1 do begin
|
|
|
- NC := l[i];
|
|
|
- If NC.Client.BytesReceived>0 then begin
|
|
|
- sClientApp := '['+IntToStr(NC.NetProtocolVersion.protocol_version)+'-'+IntToStr(NC.NetProtocolVersion.protocol_available)+'] '+NC.ClientAppVersion;
|
|
|
- end else begin
|
|
|
- sClientApp := '(no data)';
|
|
|
- end;
|
|
|
+ if Not TNetData.NetData.NetConnections.TryLockList(100,l) then exit;
|
|
|
+ try
|
|
|
+ strings := memoNetConnections.Lines;
|
|
|
+ sNSC := TStringList.Create;
|
|
|
+ sRS := TStringList.Create;
|
|
|
+ sDisc := TStringList.Create;
|
|
|
+ strings.BeginUpdate;
|
|
|
+ Try
|
|
|
+ for i := 0 to l.Count - 1 do begin
|
|
|
+ NC := l[i];
|
|
|
+ If NC.Client.BytesReceived>0 then begin
|
|
|
+ sClientApp := '['+IntToStr(NC.NetProtocolVersion.protocol_version)+'-'+IntToStr(NC.NetProtocolVersion.protocol_available)+'] '+NC.ClientAppVersion;
|
|
|
+ end else begin
|
|
|
+ sClientApp := '(no data)';
|
|
|
+ end;
|
|
|
|
|
|
- if NC.Connected then begin
|
|
|
- if NC.Client.LastCommunicationTime>1000 then begin
|
|
|
- DecodeTime(now - NC.Client.LastCommunicationTime,hh,nn,ss,ms);
|
|
|
- if (hh=0) and (nn=0) And (ss<10) then begin
|
|
|
- sLastConnTime := ' - Last comunication <10 sec.';
|
|
|
- end else begin
|
|
|
- sLastConnTime := Format(' - Last comunication %.2dm%.2ds',[(hh*60)+nn,ss]);
|
|
|
- end;
|
|
|
- end else begin
|
|
|
- sLastConnTime := '';
|
|
|
- end;
|
|
|
- if NC is TNetServerClient then begin
|
|
|
- sNSC.Add(Format('Client: IP:%s Block:%d Sent/Received:%d/%d Bytes - %s - Time offset %d - Active since %s %s',
|
|
|
- [NC.ClientRemoteAddr,NC.RemoteOperationBlock.block,NC.Client.BytesSent,NC.Client.BytesReceived,sClientApp,NC.TimestampDiff,DateTimeElapsedTime(NC.CreatedTime),sLastConnTime]));
|
|
|
+ if NC.Connected then begin
|
|
|
+ if NC.Client.LastCommunicationTime>1000 then begin
|
|
|
+ DecodeTime(now - NC.Client.LastCommunicationTime,hh,nn,ss,ms);
|
|
|
+ if (hh=0) and (nn=0) And (ss<10) then begin
|
|
|
+ sLastConnTime := ' - Last comunication <10 sec.';
|
|
|
end else begin
|
|
|
- if NC.IsMyselfServer then sNSC.Add(Format('MySelf IP:%s Sent/Received:%d/%d Bytes - %s - Time offset %d - Active since %s %s',
|
|
|
- [NC.ClientRemoteAddr,NC.Client.BytesSent,NC.Client.BytesReceived,sClientApp,NC.TimestampDiff,DateTimeElapsedTime(NC.CreatedTime),sLastConnTime]))
|
|
|
- else begin
|
|
|
- sRS.Add(Format('Remote Server: IP:%s Block:%d Sent/Received:%d/%d Bytes - %s - Time offset %d - Active since %s %s',
|
|
|
- [NC.ClientRemoteAddr,NC.RemoteOperationBlock.block,NC.Client.BytesSent,NC.Client.BytesReceived,sClientApp,NC.TimestampDiff,DateTimeElapsedTime(NC.CreatedTime),sLastConnTime]));
|
|
|
- end;
|
|
|
+ sLastConnTime := Format(' - Last comunication %.2dm%.2ds',[(hh*60)+nn,ss]);
|
|
|
end;
|
|
|
end else begin
|
|
|
- if NC is TNetServerClient then begin
|
|
|
- sDisc.Add(Format('Disconnected client: IP:%s - %s',[NC.ClientRemoteAddr,sClientApp]));
|
|
|
- end else if NC.IsMyselfServer then begin
|
|
|
- sDisc.Add(Format('Disconnected MySelf IP:%s - %s',[NC.ClientRemoteAddr,sClientApp]));
|
|
|
- end else begin
|
|
|
- sDisc.Add(Format('Disconnected Remote Server: IP:%s %s - %s',[NC.ClientRemoteAddr,CT_BooleanToString[NC.Connected],sClientApp]));
|
|
|
+ sLastConnTime := '';
|
|
|
+ end;
|
|
|
+ if NC is TNetServerClient then begin
|
|
|
+ sNSC.Add(Format('Client: IP:%s Block:%d Sent/Received:%d/%d Bytes - %s - Time offset %d - Active since %s %s',
|
|
|
+ [NC.ClientRemoteAddr,NC.RemoteOperationBlock.block,NC.Client.BytesSent,NC.Client.BytesReceived,sClientApp,NC.TimestampDiff,DateTimeElapsedTime(NC.CreatedTime),sLastConnTime]));
|
|
|
+ end else begin
|
|
|
+ if NC.IsMyselfServer then sNSC.Add(Format('MySelf IP:%s Sent/Received:%d/%d Bytes - %s - Time offset %d - Active since %s %s',
|
|
|
+ [NC.ClientRemoteAddr,NC.Client.BytesSent,NC.Client.BytesReceived,sClientApp,NC.TimestampDiff,DateTimeElapsedTime(NC.CreatedTime),sLastConnTime]))
|
|
|
+ else begin
|
|
|
+ sRS.Add(Format('Remote Server: IP:%s Block:%d Sent/Received:%d/%d Bytes - %s - Time offset %d - Active since %s %s',
|
|
|
+ [NC.ClientRemoteAddr,NC.RemoteOperationBlock.block,NC.Client.BytesSent,NC.Client.BytesReceived,sClientApp,NC.TimestampDiff,DateTimeElapsedTime(NC.CreatedTime),sLastConnTime]));
|
|
|
end;
|
|
|
end;
|
|
|
+ end else begin
|
|
|
+ if NC is TNetServerClient then begin
|
|
|
+ sDisc.Add(Format('Disconnected client: IP:%s - %s',[NC.ClientRemoteAddr,sClientApp]));
|
|
|
+ end else if NC.IsMyselfServer then begin
|
|
|
+ sDisc.Add(Format('Disconnected MySelf IP:%s - %s',[NC.ClientRemoteAddr,sClientApp]));
|
|
|
+ end else begin
|
|
|
+ sDisc.Add(Format('Disconnected Remote Server: IP:%s %s - %s',[NC.ClientRemoteAddr,CT_BooleanToString[NC.Connected],sClientApp]));
|
|
|
+ end;
|
|
|
end;
|
|
|
- strings.Clear;
|
|
|
- strings.Add(Format('Connections Updated %s Clients:%d Servers:%d (valid servers:%d)',[DateTimeToStr(now),sNSC.Count,sRS.Count,TNetData.NetData.NetStatistics.ServersConnectionsWithResponse]));
|
|
|
- strings.AddStrings(sRS);
|
|
|
- strings.AddStrings(sNSC);
|
|
|
- if sDisc.Count>0 then begin
|
|
|
- strings.Add('');
|
|
|
- strings.Add('Disconnected connections: '+Inttostr(sDisc.Count));
|
|
|
- strings.AddStrings(sDisc);
|
|
|
- end;
|
|
|
- Finally
|
|
|
- strings.EndUpdate;
|
|
|
- sNSC.Free;
|
|
|
- sRS.Free;
|
|
|
- sDisc.Free;
|
|
|
- End;
|
|
|
- //CheckMining;
|
|
|
- finally
|
|
|
- TNetData.NetData.NetConnections.UnlockList;
|
|
|
- end;
|
|
|
- Finally
|
|
|
- //FMustProcessNetConnectionUpdated := false;
|
|
|
- End;
|
|
|
+ end;
|
|
|
+ strings.Clear;
|
|
|
+ strings.Add(Format('Connections Updated %s Clients:%d Servers:%d (valid servers:%d)',[DateTimeToStr(now),sNSC.Count,sRS.Count,TNetData.NetData.NetStatistics.ServersConnectionsWithResponse]));
|
|
|
+ strings.AddStrings(sRS);
|
|
|
+ strings.AddStrings(sNSC);
|
|
|
+ if sDisc.Count>0 then begin
|
|
|
+ strings.Add('');
|
|
|
+ strings.Add('Disconnected connections: '+Inttostr(sDisc.Count));
|
|
|
+ strings.AddStrings(sDisc);
|
|
|
+ end;
|
|
|
+ Finally
|
|
|
+ strings.EndUpdate;
|
|
|
+ sNSC.Free;
|
|
|
+ sRS.Free;
|
|
|
+ sDisc.Free;
|
|
|
+ End;
|
|
|
+ //CheckMining;
|
|
|
+ finally
|
|
|
+ TNetData.NetData.NetConnections.UnlockList;
|
|
|
+ end;
|
|
|
end;
|
|
|
|
|
|
procedure TFRMNodes.OnNetConnectionsUpdated;
|