add a check for allowIncommingParents
add some extra information about parents
This commit is contained in:
parent
c3643c7f08
commit
5ebd3995a0
@ -155,7 +155,6 @@ begin
|
|||||||
else
|
else
|
||||||
if pictureformat=3 then
|
if pictureformat=3 then
|
||||||
begin
|
begin
|
||||||
|
|
||||||
fpi:=TFPMemoryImage.Create(0,0);
|
fpi:=TFPMemoryImage.Create(0,0);
|
||||||
fpr:=TFPReaderPNG.create;
|
fpr:=TFPReaderPNG.create;
|
||||||
fpi.LoadFromStream(f, fpr);
|
fpi.LoadFromStream(f, fpr);
|
||||||
|
@ -87,6 +87,7 @@ type
|
|||||||
childnodes: array of TPointerscanControllerChild;
|
childnodes: array of TPointerscanControllerChild;
|
||||||
|
|
||||||
parentUpdater: TAsyncTimer;
|
parentUpdater: TAsyncTimer;
|
||||||
|
lastUpdateSent: integer;
|
||||||
|
|
||||||
|
|
||||||
lastPathCheck: qword; //last time the path check checked the queues
|
lastPathCheck: qword; //last time the path check checked the queues
|
||||||
@ -380,6 +381,7 @@ type
|
|||||||
function getTotalThreadCount: integer;
|
function getTotalThreadCount: integer;
|
||||||
procedure getConnectingList(var l: TConnectEntryArray);
|
procedure getConnectingList(var l: TConnectEntryArray);
|
||||||
procedure getConnectionList(var l: TConnectionEntryArray);
|
procedure getConnectionList(var l: TConnectionEntryArray);
|
||||||
|
procedure getParentData(var d: TPublicParentData);
|
||||||
|
|
||||||
procedure TerminateAndSaveState;
|
procedure TerminateAndSaveState;
|
||||||
procedure execute; override;
|
procedure execute; override;
|
||||||
@ -1178,6 +1180,16 @@ begin
|
|||||||
setlength(l,0);
|
setlength(l,0);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TPointerscanController.getParentData(var d: TPublicParentData);
|
||||||
|
begin
|
||||||
|
d.connected:=parent.socket<>nil;
|
||||||
|
d.ip:=parent.ip;
|
||||||
|
d.port:=parent.port;
|
||||||
|
d.lastupdatesent:=lastUpdateSent;
|
||||||
|
d.waitingforreconnect:=orphanedSince<>0;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure TPointerscanController.appendDynamicPathQueueToOverflowQueue(paths: TDynPathQueue);
|
procedure TPointerscanController.appendDynamicPathQueueToOverflowQueue(paths: TDynPathQueue);
|
||||||
var oldstart: integer;
|
var oldstart: integer;
|
||||||
i: integer;
|
i: integer;
|
||||||
@ -2962,12 +2974,18 @@ begin
|
|||||||
|
|
||||||
if connectiontype=0 then //parent
|
if connectiontype=0 then //parent
|
||||||
begin
|
begin
|
||||||
|
if not allowIncomingParent then
|
||||||
|
raise exception.create('A parent tried to connect');
|
||||||
|
|
||||||
if parentpassword<>password then
|
if parentpassword<>password then
|
||||||
raise TSocketException.create('Invalid parent password');
|
raise TSocketException.create('Invalid parent password');
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if connectiontype=1 then //child
|
if connectiontype=1 then //child
|
||||||
begin
|
begin
|
||||||
|
if not allowIncomingChildren then
|
||||||
|
raise exception.create('A child tried to connect');
|
||||||
|
|
||||||
if childpassword<>password then
|
if childpassword<>password then
|
||||||
raise TSocketException.create('Invalid child password');
|
raise TSocketException.create('Invalid child password');
|
||||||
end
|
end
|
||||||
@ -4022,6 +4040,8 @@ begin
|
|||||||
parent.socket.WriteBuffer(updatemsg, sizeof(updatemsg));
|
parent.socket.WriteBuffer(updatemsg, sizeof(updatemsg));
|
||||||
parent.socket.flushWrites;
|
parent.socket.flushWrites;
|
||||||
|
|
||||||
|
lastUpdateSent:=GetTickCount64;
|
||||||
|
|
||||||
HandleUpdateStatusReply;
|
HandleUpdateStatusReply;
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
@ -4692,6 +4712,7 @@ begin
|
|||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
//this wants to be a parent
|
//this wants to be a parent
|
||||||
|
|
||||||
parentcs.Enter;
|
parentcs.Enter;
|
||||||
try
|
try
|
||||||
//add it to the queue
|
//add it to the queue
|
||||||
@ -4715,6 +4736,16 @@ begin
|
|||||||
else
|
else
|
||||||
parentqueue[length(parentqueue)-1].iConnectedTo:=false;
|
parentqueue[length(parentqueue)-1].iConnectedTo:=false;
|
||||||
|
|
||||||
|
len:=sizeof(ipname);
|
||||||
|
if getpeername(sockethandle, ipname, len)<>SOCKET_ERROR then
|
||||||
|
begin
|
||||||
|
parentqueue[length(parentqueue)-1].ip:=inttostr(byte(ipname.sin_addr.S_un_b.s_b1))+'.'+inttostr(byte(ipname.sin_addr.S_un_b.s_b2))+
|
||||||
|
inttostr(byte(ipname.sin_addr.S_un_b.s_b3))+'.'+inttostr(byte(ipname.sin_addr.S_un_b.s_b4));
|
||||||
|
|
||||||
|
parentqueue[length(parentqueue)-1].port:=ipname.sin_port;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//you have a new daddy! Say hello to him
|
//you have a new daddy! Say hello to him
|
||||||
|
@ -295,6 +295,12 @@ type
|
|||||||
|
|
||||||
network: record
|
network: record
|
||||||
node: TTreenode; // + network
|
node: TTreenode; // + network
|
||||||
|
|
||||||
|
parent: TTreenode; //ip+port or disconnected
|
||||||
|
parentnodes: record
|
||||||
|
lastUpdateSent: TTreenode;
|
||||||
|
end;
|
||||||
|
|
||||||
connectingto: TTreenode;
|
connectingto: TTreenode;
|
||||||
connectingToNodes: array of record
|
connectingToNodes: array of record
|
||||||
data: TTreenode; //ip, port, trusted
|
data: TTreenode; //ip, port, trusted
|
||||||
@ -1227,7 +1233,7 @@ begin
|
|||||||
|
|
||||||
staticscanner.Start;
|
staticscanner.Start;
|
||||||
|
|
||||||
|
pnlData.Visible:=true;
|
||||||
timer2.enabled:=true;
|
timer2.enabled:=true;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -1594,6 +1600,7 @@ var i,j: integer;
|
|||||||
|
|
||||||
connectinglist: TConnectEntryArray;
|
connectinglist: TConnectEntryArray;
|
||||||
connectionlist: TConnectionEntryArray;
|
connectionlist: TConnectionEntryArray;
|
||||||
|
parentdata: TPublicParentData;
|
||||||
|
|
||||||
info: tstringlist;
|
info: tstringlist;
|
||||||
|
|
||||||
@ -1744,28 +1751,26 @@ begin
|
|||||||
infonodes.network.connectingToNodes[i].data.Free;
|
infonodes.network.connectingToNodes[i].data.Free;
|
||||||
|
|
||||||
setlength(infonodes.network.connectingToNodes, length(connectinglist));
|
setlength(infonodes.network.connectingToNodes, length(connectinglist));
|
||||||
|
//connecting to:
|
||||||
|
if infonodes.network.connectingto=nil then
|
||||||
|
infonodes.network.connectingto:=tvInfo.Items.AddChild(infonodes.network.node,'Connecting to:');
|
||||||
|
|
||||||
if length(connectinglist)>0 then
|
|
||||||
|
|
||||||
|
|
||||||
|
for i:=0 to length(connectinglist)-1 do
|
||||||
begin
|
begin
|
||||||
if infonodes.network.connectingto=nil then
|
if infonodes.network.connectingToNodes[i].data=nil then //create a new one
|
||||||
infonodes.network.connectingto:=tvInfo.Items.AddChild(infonodes.network.node,'Connecting to:');
|
infonodes.network.connectingToNodes[i].data:=tvinfo.Items.add(infonodes.network.connectingto,'');
|
||||||
|
|
||||||
|
s:=connectinglist[i].ip+':'+inttostr(connectinglist[i].port);
|
||||||
|
if connectinglist[i].becomeparent=false then
|
||||||
|
s:=s+BoolToStr(connectinglist[i].trusted, ' (Trusted)','');
|
||||||
|
|
||||||
|
infonodes.network.connectingToNodes[i].data.Text:=s;
|
||||||
|
|
||||||
for i:=0 to length(connectinglist)-1 do
|
|
||||||
begin
|
|
||||||
if infonodes.network.connectingToNodes[i].data=nil then //create a new one
|
|
||||||
infonodes.network.connectingToNodes[i].data:=tvinfo.Items.add(infonodes.network.connectingto,'');
|
|
||||||
|
|
||||||
s:=connectinglist[i].ip+':'+inttostr(connectinglist[i].port);
|
|
||||||
if connectinglist[i].becomeparent=false then
|
|
||||||
s:=s+BoolToStr(connectinglist[i].trusted, ' (Trusted)','');
|
|
||||||
|
|
||||||
infonodes.network.connectingToNodes[i].data.Text:=s;
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
staticscanner.getConnectionList(connectionlist);
|
staticscanner.getConnectionList(connectionlist);
|
||||||
|
|
||||||
for i:=length(infonodes.network.connectedToNodes)-1 downto length(connectionlist) do
|
for i:=length(infonodes.network.connectedToNodes)-1 downto length(connectionlist) do
|
||||||
@ -1774,63 +1779,96 @@ begin
|
|||||||
setlength(infonodes.network.connectedToNodes, length(connectionlist));
|
setlength(infonodes.network.connectedToNodes, length(connectionlist));
|
||||||
|
|
||||||
|
|
||||||
if length(connectionlist)>0 then
|
//connected to:
|
||||||
|
|
||||||
|
if Staticscanner.initializer=false then
|
||||||
begin
|
begin
|
||||||
if infonodes.network.connectedTo=nil then
|
staticscanner.getParentData(parentdata);
|
||||||
infonodes.network.connectedTo:=tvInfo.Items.AddChild(infonodes.network.node,'Connected to:');
|
|
||||||
|
|
||||||
for i:=0 to length(connectionlist)-1 do
|
if infonodes.network.parent=nil then
|
||||||
|
infonodes.network.parent:=tvInfo.Items.AddChild(infonodes.network.node,'Parent: ');
|
||||||
|
|
||||||
|
if parentdata.connected then
|
||||||
begin
|
begin
|
||||||
if infonodes.network.connectedToNodes[i].node=nil then //create it
|
infonodes.network.parent.Text:='Parent: '+parentdata.ip+':'+inttostr(parentdata.port);
|
||||||
begin
|
|
||||||
infonodes.network.connectedToNodes[i].node:=tvInfo.Items.AddChild(infonodes.network.connectedTo, s);
|
|
||||||
tn:=infonodes.network.connectedToNodes[i].node;
|
|
||||||
|
|
||||||
with infonodes.network.connectedToNodes[i].data do
|
if infonodes.network.parentnodes.lastUpdateSent=nil then
|
||||||
begin
|
infonodes.network.parentnodes.lastUpdateSent:=tvInfo.Items.AddChild(infonodes.network.parent,'');
|
||||||
trusted:=tvInfo.Items.AddChild(tn, '');
|
|
||||||
totalthreadcount:=tvInfo.Items.AddChild(tn, '');
|
|
||||||
resultsfound:=tvInfo.Items.AddChild(tn, '');
|
|
||||||
pathqueuesize:=tvInfo.Items.AddChild(tn, '');
|
|
||||||
totalpathquesize:=tvInfo.Items.AddChild(tn, '');
|
|
||||||
totalpathsEvaluated:=tvInfo.Items.AddChild(tn, '');
|
|
||||||
// pathspersecond:=tvInfo.Items.AddChild(tn, '');
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
s:=connectionlist[i].ip+':'+inttostr(connectionlist[i].port);
|
infonodes.network.parentnodes.lastUpdateSent.Text:=inttostr(GetTickCount64-parentdata.lastupdatesent div 1000)+' seconds ago';
|
||||||
if connectionlist[i].disconnected then
|
|
||||||
s:=s+' (Disconnected)'
|
end
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
//mark that it has no parent (yet/anymore)
|
||||||
|
if parentdata.waitingforreconnect then
|
||||||
|
infonodes.network.parent.Text:='Parent: <disconnected> (Waiting for reconnect)'
|
||||||
else
|
else
|
||||||
begin
|
infonodes.network.parent.Text:='Parent: <none>';
|
||||||
if connectionlist[i].isidle=false then
|
|
||||||
s:=s+' (Active)'
|
|
||||||
else
|
|
||||||
s:=s+' (Idle)';
|
|
||||||
|
|
||||||
if connectionlist[i].uploadingscandata then
|
//if there are nodes, delete them
|
||||||
s:=s+format(' (Uploading scandata: %d (%dK/sec)', [connectionlist[i].uploadscandataprogress, connectionlist[i].uploadscandataspeed]);
|
if infonodes.network.parentnodes.lastUpdateSent<>nil then
|
||||||
|
freeandnil(infonodes.network.parentnodes.lastUpdateSent);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
if connectionlist[i].downloadingResuls then
|
if infonodes.network.connectedTo=nil then
|
||||||
s:=s+' (Downloading and handling results)';
|
infonodes.network.connectedTo:=tvInfo.Items.AddChild(infonodes.network.node,'Children:');
|
||||||
end;
|
|
||||||
|
|
||||||
infonodes.network.connectedToNodes[i].node.Text:=s;
|
for i:=0 to length(connectionlist)-1 do
|
||||||
|
begin
|
||||||
|
if infonodes.network.connectedToNodes[i].node=nil then //create it
|
||||||
|
begin
|
||||||
|
infonodes.network.connectedToNodes[i].node:=tvInfo.Items.AddChild(infonodes.network.connectedTo, s);
|
||||||
|
tn:=infonodes.network.connectedToNodes[i].node;
|
||||||
|
|
||||||
with infonodes.network.connectedToNodes[i].data do
|
with infonodes.network.connectedToNodes[i].data do
|
||||||
begin
|
begin
|
||||||
trusted.text:='Trusted: '+BoolToStr(connectionlist[i].trustedconnection, 'True', 'False');
|
trusted:=tvInfo.Items.AddChild(tn, '');
|
||||||
totalthreadcount.text:='Total threadcount: '+IntToStr(connectionlist[i].threadcount);
|
totalthreadcount:=tvInfo.Items.AddChild(tn, '');
|
||||||
resultsfound.text:='Results found: '+IntToStr(connectionlist[i].resultsfound);
|
resultsfound:=tvInfo.Items.AddChild(tn, '');
|
||||||
pathqueuesize.text:='Queuesize: '+inttostr(connectionlist[i].pathquesize);
|
pathqueuesize:=tvInfo.Items.AddChild(tn, '');
|
||||||
totalpathquesize.text:='Total Queuesize: '+inttostr(connectionlist[i].totalpathqueuesize);
|
totalpathquesize:=tvInfo.Items.AddChild(tn, '');
|
||||||
totalpathsEvaluated.text:='Paths evaluated: '+inttostr(connectionlist[i].pathsevaluated);
|
totalpathsEvaluated:=tvInfo.Items.AddChild(tn, '');
|
||||||
//pathspersecond.text:='Paths/second: '+inttostr(connectionlist[i].pathspersecond);
|
// pathspersecond:=tvInfo.Items.AddChild(tn, '');
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
s:=connectionlist[i].ip+':'+inttostr(connectionlist[i].port);
|
||||||
|
if connectionlist[i].disconnected then
|
||||||
|
s:=s+' (Disconnected)'
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
if connectionlist[i].isidle=false then
|
||||||
|
s:=s+' (Active)'
|
||||||
|
else
|
||||||
|
s:=s+' (Idle)';
|
||||||
|
|
||||||
|
if connectionlist[i].uploadingscandata then
|
||||||
|
s:=s+format(' (Uploading scandata: %d (%dK/sec)', [connectionlist[i].uploadscandataprogress, connectionlist[i].uploadscandataspeed]);
|
||||||
|
|
||||||
|
if connectionlist[i].downloadingResuls then
|
||||||
|
s:=s+' (Downloading and handling results)';
|
||||||
|
end;
|
||||||
|
|
||||||
|
infonodes.network.connectedToNodes[i].node.Text:=s;
|
||||||
|
|
||||||
|
with infonodes.network.connectedToNodes[i].data do
|
||||||
|
begin
|
||||||
|
trusted.text:='Trusted: '+BoolToStr(connectionlist[i].trustedconnection, 'True', 'False');
|
||||||
|
totalthreadcount.text:='Total threadcount: '+IntToStr(connectionlist[i].threadcount);
|
||||||
|
resultsfound.text:='Results found: '+IntToStr(connectionlist[i].resultsfound);
|
||||||
|
pathqueuesize.text:='Queuesize: '+inttostr(connectionlist[i].pathquesize);
|
||||||
|
totalpathquesize.text:='Total Queuesize: '+inttostr(connectionlist[i].totalpathqueuesize);
|
||||||
|
totalpathsEvaluated.text:='Paths evaluated: '+inttostr(connectionlist[i].pathsevaluated);
|
||||||
|
//pathspersecond.text:='Paths/second: '+inttostr(connectionlist[i].pathspersecond);
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
except
|
except
|
||||||
|
@ -12,6 +12,14 @@ uses
|
|||||||
Classes, SysUtils;
|
Classes, SysUtils;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
TPublicParentData=record
|
||||||
|
connected: boolean;
|
||||||
|
ip: string;
|
||||||
|
port: word;
|
||||||
|
lastupdatesent: qword;
|
||||||
|
waitingforreconnect: boolean;
|
||||||
|
end;
|
||||||
|
|
||||||
TPublicConnectionEntry=record //information publicly available about children
|
TPublicConnectionEntry=record //information publicly available about children
|
||||||
parentconnectedto: boolean; //true if the parent connected to the child
|
parentconnectedto: boolean; //true if the parent connected to the child
|
||||||
ip: string;
|
ip: string;
|
||||||
|
@ -37,6 +37,8 @@ type
|
|||||||
port: word;
|
port: word;
|
||||||
password: string;
|
password: string;
|
||||||
end;
|
end;
|
||||||
|
ip: string;
|
||||||
|
port: word;
|
||||||
|
|
||||||
trustsme: boolean;
|
trustsme: boolean;
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user