Chat API update. Breaks everything.
[brdnet.git] / dhtBootStatic.pas
blob59e15fa39c37beb438c6a2144b61779adfb03713
1 unit dhtBootStatic;
3 Bootstrap the dht from set of static nodes
4 from file.
7 INTERFACE
9 IMPLEMENTATION
10 uses NetAddr,ServerLoop,DHT,SysUtils;
12 type t=object
13 procedure Boot;
14 end;
16 procedure t.Boot;
17 var bs:TextFile;
18 const bsfn='bootstrap.txt';
19 var line:string;
20 var addr:tNetAddr;
21 begin
22 assign(bs,bsfn);
23 try
24 reset(bs);
25 except
26 writeln('BootStatic: Error opening file '+bsfn);
27 exit;
28 end;
29 try
30 while not eof(bs) do begin
31 readln(bs,line);
32 try addr.FromString(line);
33 except on eConvertError do begin
34 writeln('BootStatic: ConvertError ',line,' to tNetAddr');
35 continue;
36 end end;
37 DHT.NodeBootstrap(addr);
38 end;
39 finally
40 close(bs);
41 end;
42 end;
44 var o:t;
45 BEGIN
46 Shedule(700,@o.boot);
47 END.