added single function to call dht, with thread cleanup.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-gxs-b1@5954 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
drbob 2012-12-09 13:19:28 +00:00
parent 3be22536df
commit 62176264d3
5 changed files with 493 additions and 444 deletions

View File

@ -8,7 +8,7 @@ LIBS = -L../lib -lbitdht -lpthread
EXEC : bssdht
EGOBJ = bdhandler.o bssdht.o
EGOBJ = bdhandler.o bssdht.o bootstrap_fn.o
bssdht: $(EGOBJ)
$(CXX) $(CXXFLAGS) -o bssdht $(EGOBJ) $(LIBS)

View File

@ -1,394 +1,5 @@
213.200.49.94 49729
78.106.255.53 33010
176.52.10.54 6881
178.89.155.147 6881
125.14.197.62 14856
218.77.193.68 16001
86.149.90.0 63079
24.132.253.237 16107
85.54.115.28 30782
79.136.30.100 63177
89.136.253.72 32789
109.254.115.106 46229
89.120.65.238 63900
79.164.94.231 8093
109.195.107.54 6881
109.60.234.178 60562
182.218.241.146 32308
188.16.212.171 6881
213.85.86.61 6881
117.220.183.198 48158
125.137.92.58 45682
122.80.243.249 16001
123.165.178.125 9371
85.64.42.90 46866
91.241.136.195 48137
178.217.52.84 20801
46.233.208.225 14158
37.79.136.74 35691
109.252.88.7 61862
119.166.13.162 57726
95.25.120.195 6881
109.88.60.207 37375
77.66.244.147 6881
176.77.24.252 35691
78.25.175.94 39012
109.194.253.133 19755
195.169.226.124 51413
90.151.219.90 6881
93.124.15.169 22826
90.39.156.179 21066
89.222.164.65 28505
91.146.55.126 15984
46.0.142.177 65116
188.186.105.35 6881
212.21.3.78 6881
94.190.76.151 61998
90.150.121.152 6881
188.234.162.195 6881
212.87.184.183 18025
95.105.53.122 10022
109.110.233.223 63596
46.149.234.13 6881
92.112.33.50 17016
188.244.159.76 6881
109.226.65.214 30220
89.204.37.237 6881
81.182.61.244 62762
31.23.11.165 23690
92.112.227.98 16020
188.173.249.241 10649
65.28.74.168 16111
108.252.61.27 30097
67.164.44.138 1025
112.136.180.195 28478
61.31.128.123 11708
203.202.219.105 26397
85.180.71.212 28824
85.17.30.203 51721
194.44.93.49 41558
79.115.140.239 6881
212.57.143.230 64209
213.57.220.71 54355
188.25.152.209 38685
24.215.90.104 50000
85.173.79.113 43424
69.254.137.136 59805
95.21.157.21 38284
91.66.234.126 45618
69.81.91.160 36510
37.11.69.120 21518
82.251.167.100 27364
178.95.174.115 27719
71.95.96.165 30732
109.222.228.8 31901
24.192.64.18 48809
50.72.178.188 44692
69.76.203.21 60466
82.234.232.63 22112
199.21.113.184 64103
89.80.119.247 57369
88.72.174.111 9023
86.29.84.7 56010
79.47.210.148 15421
92.144.216.198 61409
81.64.209.233 6262
86.70.194.6 8000
178.83.6.65 6881
83.246.219.62 12485
95.73.12.140 56350
188.190.58.2 27739
92.252.210.194 10000
94.23.49.143 8000
199.127.250.15 29015
78.119.199.7 55227
82.242.173.60 48585
108.207.210.177 17312
81.101.178.26 36319
86.126.203.68 10566
178.223.153.97 23683
218.111.12.128 59991
74.132.175.138 63239
24.239.251.33 55679
77.9.88.33 8812
86.105.83.234 64836
78.26.200.70 53675
109.126.218.243 49001
178.120.24.237 23854
5.164.220.86 46394
83.165.232.251 11618
176.14.184.224 47779
37.229.58.159 25397
89.112.45.232 51413
71.227.228.178 59982
94.8.63.12 21695
178.83.119.5 6881
213.109.4.140 35063
174.66.162.145 19398
189.4.72.127 43453
112.203.4.67 15817
178.216.101.214 54537
79.134.52.11 52512
192.162.43.69 45684
85.240.205.157 18883
188.232.238.194 59524
123.110.8.223 15666
61.19.218.36 50115
83.215.168.25 64268
80.2.83.216 16532
188.124.72.59 32042
89.46.178.134 39707
202.177.248.237 51359
88.174.176.173 56969
50.98.183.171 47301
85.59.136.223 43831
188.190.69.190 40122
82.155.56.186 20870
109.9.102.56 16279
220.245.18.37 7952
24.53.148.27 20698
88.156.186.185 51413
68.101.70.42 48176
108.38.11.220 57600
99.102.20.107 34921
112.186.84.12 30224
89.3.61.74 63799
46.72.18.191 38514
85.142.195.67 6881
201.24.196.143 21263
88.72.174.111 14804
141.84.252.30 6881
93.218.175.120 47467
83.134.21.238 39471
81.229.168.10 32995
88.170.61.126 7465
83.254.77.158 22722
78.94.71.48 51091
94.45.103.205 23560
46.119.32.172 40356
37.204.127.80 34869
78.53.125.16 1451
91.219.249.72 6881
2.60.134.63 42890
188.195.233.196 7971
109.209.82.52 1064
80.217.87.125 47610
92.151.189.10 41785
71.237.6.246 41304
176.15.199.156 35691
37.14.117.203 24956
188.165.245.29 62201
31.192.204.87 36504
217.73.165.50 65165
78.126.57.136 29452
95.16.39.183 51413
68.229.157.53 20538
24.15.208.182 19353
178.72.76.27 10693
49.204.188.72 15546
74.172.229.212 9518
126.11.175.228 46373
60.181.173.66 16001
71.245.169.177 43766
96.55.113.202 17765
77.31.69.213 16975
14.192.149.235 14523
116.114.184.23 16001
46.73.180.200 57274
109.167.205.91 17782
109.248.165.232 29068
37.112.101.205 12115
67.193.153.219 61956
84.109.194.47 46742
188.24.75.81 63815
223.98.124.220 16001
90.56.104.115 11101
81.190.219.203 14573
89.99.220.211 6881
78.129.47.89 25456
72.89.174.47 49559
66.169.55.105 10610
178.129.164.236 6881
99.164.69.36 44396
121.182.147.191 62483
46.214.22.165 20056
90.196.26.145 62421
109.110.147.6 51158
93.152.154.146 63760
111.253.207.38 16001
125.27.214.216 44366
77.243.107.6 8392
83.128.123.13 22300
62.80.235.202 39059
178.120.2.179 18001
204.11.130.66 6881
178.122.94.160 10024
142.167.185.66 51623
72.84.241.61 23793
95.29.249.76 6881
77.41.8.139 6881
109.165.86.68 6881
109.111.3.95 42832
89.222.164.39 17108
86.198.46.107 64700
46.0.195.115 6881
217.123.236.239 59665
88.206.83.163 6881
2.217.94.215 62479
85.27.36.125 3675
94.23.55.33 33530
89.222.164.74 8750
213.111.210.47 44581
75.158.101.190 59340
80.184.122.10 15829
81.235.246.100 57582
5.187.78.80 50811
93.74.114.37 33017
24.30.83.45 54662
121.187.196.166 61829
87.97.70.95 59216
92.101.49.41 15939
177.132.219.232 52537
217.15.129.218 15808
116.14.132.15 56063
76.177.90.141 36194
88.90.45.47 58649
77.57.165.254 6881
80.98.76.72 43577
78.30.207.121 16466
109.89.22.180 30439
68.190.74.32 22007
36.236.16.67 16001
114.163.214.158 11302
2.97.93.187 57692
94.253.39.133 6881
79.139.88.71 10208
59.126.161.235 42539
81.234.255.202 56118
117.200.86.161 53208
31.46.125.31 18045
82.243.71.203 65432
78.224.185.52 56621
76.204.112.132 6890
93.223.130.30 32417
87.223.168.225 26656
173.73.46.92 52828
178.202.38.237 40068
109.14.228.2 6969
95.157.142.198 64123
220.245.1.193 64765
62.227.10.103 19379
192.228.212.170 21654
66.197.135.74 9870
37.221.132.150 22894
94.21.58.12 38698
188.176.186.181 18273
188.190.155.210 4455
108.252.160.139 42007
94.23.204.135 30392
63.245.169.145 33247
93.96.38.245 6881
31.45.22.161 35225
77.222.31.52 59415
96.42.167.80 52280
190.196.105.132 14079
117.201.208.178 10171
187.104.231.26 33447
68.42.14.214 23361
67.167.214.225 63185
24.138.59.223 55955
111.242.33.86 23406
125.30.116.231 18391
123.23.70.154 10075
78.229.90.129 32138
69.112.56.177 44811
31.16.41.107 7627
92.141.209.132 15734
79.118.37.244 40171
66.49.128.103 51413
178.90.62.99 10000
178.157.237.100 6881
91.178.167.101 30268
206.248.183.2 51413
93.86.246.79 12180
109.193.181.26 17836
90.224.116.7 33923
37.144.199.41 32118
89.123.71.101 10982
112.204.163.100 13292
125.24.197.213 11698
46.63.180.70 54251
217.210.112.89 20503
213.64.227.205 18926
123.203.151.250 56045
114.37.64.184 25431
86.8.232.198 47955
213.181.202.91 51413
37.229.225.109 24351
2.33.68.167 45682
88.222.217.56 46421
90.208.116.214 55538
2.124.113.120 51413
211.228.97.32 11160
85.67.228.231 33392
93.116.242.153 33116
94.51.121.80 59150
113.171.86.250 10000
5.159.110.99 26947
58.7.253.60 38684
91.229.20.68 6881
91.179.116.59 17040
117.195.47.150 49441
42.98.29.129 22491
85.167.147.174 34182
82.242.149.9 25108
85.108.197.61 29286
95.56.72.49 14451
83.150.118.223 7200
83.246.191.21 6881
82.49.66.69 26973
50.53.84.14 47235
88.212.37.175 40585
84.55.102.97 49909
82.168.130.135 56755
46.173.90.211 6881
109.169.54.139 51415
114.34.93.180 20810
99.231.123.139 47345
125.212.120.5 21305
109.128.196.245 51413
176.215.30.14 28689
98.30.187.130 21000
75.73.136.19 62765
212.19.133.88 13525
108.202.164.27 51413
2.49.208.236 46064
116.51.131.3 47451
78.155.189.90 22557
2.3.154.124 43411
46.251.69.224 11789
85.138.161.222 28829
94.181.133.210 35691
41.69.137.231 13336
49.48.231.206 64581
82.7.153.234 39772
94.113.125.164 27426
75.48.224.72 51413
176.103.81.177 52440
37.218.152.141 24385
221.149.52.79 11254
213.114.77.51 61820
178.22.225.30 11104
92.84.81.34 57407
93.146.94.221 19306
171.116.86.165 16001
101.63.130.19 48832
85.84.221.4 19153
79.126.54.102 37807
74.77.92.19 51413
46.108.138.39 25884
92.247.220.203 25527
89.20.124.41 6881
99.189.14.81 43179
211.193.20.248 25381
223.228.164.49 18616
@ -397,7 +8,6 @@
87.89.35.111 41473
46.2.98.125 26797
71.201.85.238 63526
83.143.127.228 51413
89.142.117.227 60538
109.198.205.30 49001
92.126.225.35 10022
@ -410,7 +20,6 @@
94.211.208.25 16881
211.28.147.189 30748
46.50.162.228 6881
122.116.89.184 59116
110.93.91.8 38100
84.248.75.232 63001
79.165.148.92 61137
@ -418,46 +27,36 @@
180.224.43.232 63573
79.82.223.182 29297
78.7.87.150 28643
67.235.141.60 19894
27.190.132.73 4245
93.123.197.174 58547
89.216.145.187 1055
68.46.237.222 34912
69.181.68.72 60496
107.193.240.30 51276
89.148.6.32 54889
92.112.84.248 10007
194.44.21.96 58530
93.116.77.214 10035
37.79.42.73 32840
64.218.114.247 60600
95.178.198.186 28243
99.137.237.26 49238
112.134.68.224 10008
89.41.56.250 15440
86.205.207.176 56623
60.220.85.253 13569
109.174.114.124 3725
89.23.163.173 19575
79.119.183.29 52107
59.66.110.93 27589
78.105.105.87 42127
95.69.207.44 35691
72.200.187.124 48593
178.123.203.73 6881
77.35.153.182 16318
201.22.70.49 12947
80.236.120.181 14451
222.212.42.236 6107
85.25.110.34 62453
86.24.133.104 42572
82.126.184.158 31323
95.154.177.131 19995
1.22.41.112 37043
74.190.24.27 11742
70.123.139.33 45645
67.78.205.194 5007
208.101.109.128 53329
184.99.81.210 65160
24.30.119.63 46448
84.10.80.103 512
@ -474,7 +73,6 @@
212.231.247.212 18744
212.253.173.114 57417
69.157.252.118 63494
95.108.119.185 46830
213.112.21.57 27077
95.79.173.173 42349
76.121.182.77 54059
@ -482,8 +80,6 @@
92.124.7.63 26804
176.43.91.144 55976
220.135.191.36 13894
78.230.236.178 51528
194.213.106.70 49001
176.110.229.36 13664
178.88.53.243 19564
124.169.108.217 34547
@ -494,7 +90,411 @@
79.131.212.125 16844
142.68.216.103 20804
123.238.67.137 16515
50.13.6.176 23275
58.170.3.84 34130
91.122.18.146 49001
76.116.68.100 53034
188.16.212.171 6881
91.241.136.195 48137
46.149.234.13 6881
109.110.233.223 63596
194.44.93.49 41558
65.28.74.168 16111
203.202.219.105 26397
24.215.90.104 50000
83.246.219.62 12485
86.29.84.7 56010
24.192.64.18 48809
81.101.178.26 36319
83.165.232.251 11618
199.127.250.15 29015
178.83.119.5 6881
178.216.101.214 54537
89.80.119.247 57369
188.124.72.59 32042
61.19.218.36 50115
188.190.69.190 40122
99.102.20.107 34921
88.174.176.173 56969
91.219.249.72 6881
68.229.157.53 20538
96.55.113.202 17765
67.193.153.219 61956
66.169.55.105 10610
46.214.22.165 20056
83.128.123.13 22300
77.41.8.139 6881
213.111.210.47 44581
24.30.83.45 54662
94.23.55.33 33530
85.27.36.125 3675
88.90.45.47 58649
78.30.207.121 16466
76.177.90.141 36194
82.243.71.203 65432
37.221.132.150 22894
78.224.185.52 56621
141.84.252.30 6881
173.73.46.92 52828
94.23.204.135 30392
187.104.231.26 33447
86.8.232.198 47955
85.67.228.231 33392
82.242.149.9 25108
83.246.191.21 6881
84.55.102.97 49909
109.169.54.139 51415
85.138.161.222 28829
98.30.187.130 21000
108.202.164.27 51413
94.113.125.164 27426
83.143.127.228 51413
89.20.124.41 6881
122.116.89.184 59116
194.44.21.96 58530
89.41.56.250 15440
86.24.133.104 42572
95.154.177.131 19995
107.193.240.30 51276
78.105.105.87 42127
220.245.1.193 64765
95.108.119.185 46830
208.101.109.128 53329
78.230.236.178 51528
194.213.106.70 49001
70.72.180.170 10512
50.13.6.176 23275
37.57.17.197 51413
208.92.21.235 51413
65.28.234.9 6881
75.198.61.145 31237
105.232.142.153 21451
67.235.141.60 19894
142.162.222.55 40058
95.69.207.44 35691
83.219.215.44 26998
50.141.207.46 40489
106.160.47.184 63666
60.242.97.209 61577
105.236.24.75 39427
79.131.84.242 29367
114.95.228.227 11935
69.158.76.219 58971
74.172.229.212 9518
176.196.29.72 6881
50.92.192.233 16212
176.44.25.96 44441
87.223.16.63 46512
95.211.209.162 6881
89.17.34.66 36894
81.5.117.20 6881
31.6.128.147 22276
95.81.228.126 56110
101.62.20.221 58576
83.215.168.25 64268
78.227.57.127 26565
93.92.199.52 14785
70.184.208.133 1664
85.64.42.90 46866
159.224.152.53 6881
81.198.240.120 19131
109.165.217.191 17096
82.80.164.128 51640
173.12.200.5 5996
67.197.115.77 33457
24.128.99.196 2008
93.100.4.123 18048
178.214.163.7 34442
24.247.179.164 8929
217.145.16.253 6881
63.142.211.249 19399
50.66.93.232 48452
91.217.90.22 58541
89.250.174.38 49001
75.82.172.220 22018
134.3.49.58 5291
87.106.249.208 4281
78.222.160.139 37995
217.28.239.38 55049
79.173.119.29 21694
178.44.153.14 49001
119.247.118.205 51413
190.175.67.129 23239
2.216.70.171 37033
128.79.124.229 23057
142.177.120.18 6881
210.188.39.160 15231
78.129.47.89 25456
217.44.226.98 50660
46.188.25.222 64762
78.182.157.168 13141
109.62.139.85 34753
86.97.18.110 14117
122.163.241.196 10060
124.148.58.177 42765
88.190.17.198 51413
37.9.53.15 51413
94.248.201.81 11772
2.94.239.104 26341
72.80.63.47 6881
69.14.228.42 1078
76.64.217.54 44401
98.240.147.38 10544
95.165.76.74 37744
74.89.151.131 61137
78.81.42.64 29105
46.12.152.63 60689
89.88.176.161 42176
92.155.213.221 10760
99.188.192.23 57738
182.186.67.163 58144
189.101.136.201 54470
80.216.2.3 63177
89.176.181.183 1087
178.207.233.208 50370
70.51.252.250 59696
178.187.192.77 30634
124.168.238.135 39529
221.205.98.141 16001
81.184.83.43 41535
151.25.78.87 6881
188.27.197.94 18544
86.135.42.108 45193
71.235.78.32 47377
98.197.97.188 8080
118.171.164.182 17029
78.181.27.239 52402
95.32.130.29 27924
95.252.234.95 50817
23.17.78.202 49692
50.143.162.189 42846
1.161.24.188 21927
222.54.48.68 16001
112.162.27.161 35550
126.107.170.119 20880
83.221.190.99 41062
86.126.166.8 6881
31.148.57.186 16186
5.13.37.159 11670
213.176.229.38 56810
96.54.26.71 61490
110.54.21.50 27407
86.127.60.231 46314
5.56.181.94 46671
1.53.165.182 10003
60.241.238.77 8770
80.82.69.214 25390
70.179.27.230 12225
88.126.12.12 9913
87.153.100.103 8812
130.204.152.216 45685
77.255.17.211 43635
24.61.199.37 64784
84.90.254.199 47998
68.144.77.17 35420
219.124.192.58 18146
94.242.209.168 51583
95.96.151.231 14919
89.71.154.95 10001
62.102.170.64 41780
213.242.54.224 49001
50.132.115.253 30465
115.64.212.244 53921
90.48.214.148 30108
99.112.168.210 26608
218.250.225.144 8106
213.113.112.93 54916
89.133.27.246 6881
89.169.167.250 60000
90.34.205.80 30677
63.245.169.145 33247
31.23.203.196 49663
195.28.2.158 12120
109.86.138.84 6881
24.211.235.136 63005
123.48.88.21 21943
220.233.66.245 44474
202.89.161.121 49122
124.170.105.167 62750
88.161.230.36 23991
79.111.222.93 10223
208.102.53.151 50934
78.84.18.116 35625
50.194.191.60 6881
70.31.41.207 51413
105.237.27.137 23483
50.201.138.122 10228
188.244.175.193 6881
128.72.188.87 9089
123.30.74.10 25520
18.93.14.55 33270
66.197.135.74 9870
75.70.84.67 52856
112.161.223.134 27497
151.50.187.42 46187
69.204.231.202 6881
95.176.193.130 38527
2.30.11.167 40530
89.231.133.106 41153
178.167.122.78 46139
87.209.76.83 5867
178.210.228.105 29112
95.220.26.219 6881
85.30.93.63 42042
74.207.143.127 11098
37.192.22.115 35691
124.153.224.247 49237
37.153.18.111 50627
95.139.209.35 35691
82.234.232.63 22112
109.10.172.35 19332
31.130.17.162 49001
92.113.123.121 46094
108.193.168.193 46057
211.193.27.61 63664
203.189.97.152 51413
92.39.237.243 59899
80.236.120.181 14451
178.223.171.122 18225
86.62.146.229 35500
90.227.58.41 25523
46.35.227.173 10048
2.132.96.20 51413
174.2.56.170 10010
2.227.33.181 48652
79.182.21.2 49965
184.99.119.173 65160
90.193.128.203 61929
89.92.244.72 61340
90.18.32.30 52308
90.53.53.66 35604
91.82.34.163 12345
89.2.143.46 18263
50.47.16.36 59940
75.65.71.119 23100
94.23.49.143 8000
82.226.200.209 52277
109.120.214.119 36064
95.135.74.56 13267
146.158.20.181 50776
82.238.176.52 31771
72.208.178.104 46970
69.114.139.178 1362
217.77.20.134 30948
83.139.140.222 29412
178.64.14.32 6881
187.57.85.11 46431
122.195.185.77 16001
14.192.142.81 41286
95.19.48.206 54069
46.230.20.171 51413
95.39.223.81 6881
79.140.174.180 19461
195.228.61.152 16866
67.61.23.36 42086
14.47.26.94 14485
112.21.1.31 16001
122.193.188.86 1898
188.25.63.152 23937
90.190.20.83 21848
95.24.50.40 53036
180.183.44.124 24982
123.108.226.150 57551
109.64.212.115 54142
89.211.83.21 29166
189.69.171.229 15917
111.242.44.151 22774
114.36.19.36 8355
14.53.82.76 40210
46.150.6.40 17728
84.79.92.79 27171
83.28.102.138 53960
83.220.90.91 6881
89.159.16.254 11685
176.110.246.47 40629
122.150.55.60 38882
188.194.175.190 33778
89.135.99.47 59207
94.65.207.68 24008
46.250.118.60 40701
31.41.60.45 57526
151.28.154.129 28802
78.84.68.154 16279
176.37.2.4 6881
37.6.121.100 31426
178.88.93.202 12040
14.192.246.113 49890
193.41.184.234 54938
83.99.181.118 28483
66.225.173.246 60004
31.163.131.173 27658
65.94.209.166 11472
112.205.2.4 64962
176.9.113.77 61059
93.170.28.181 12881
79.112.132.33 32289
92.49.156.87 52656
188.77.209.54 23530
116.202.121.222 43976
95.155.254.176 15578
97.83.52.73 33541
98.197.136.107 12520
90.189.44.100 60868
123.194.41.195 16001
183.101.164.6 29659
200.92.49.217 16001
124.190.113.47 31938
94.179.174.22 25607
95.46.211.49 17436
188.186.23.213 34609
86.160.200.122 32684
92.152.98.221 1064
71.237.6.246 41304
83.252.40.219 43038
24.139.75.159 17025
108.77.18.29 55320
79.168.31.62 2622
182.166.177.138 57349
94.237.78.107 27652
95.136.148.114 24567
188.126.41.103 26312
46.63.212.84 35792
177.16.241.106 45271
178.74.226.9 48498
79.116.11.221 40618
128.71.72.219 62133
109.127.166.38 64454
86.156.165.112 50381
78.145.36.188 58753
176.14.161.86 6881
109.101.34.240 10902
31.180.55.227 10034
85.75.7.212 51413
87.222.93.176 51820
59.129.70.216 51214
59.189.224.35 48952
37.229.150.137 63483
95.154.52.203 24703
88.102.56.243 10016
213.22.43.68 16088
91.77.79.161 49001
46.159.213.98 48679
37.229.166.186 58189
118.166.174.251 16001
94.45.187.36 34921
109.238.98.207 28281
62.141.219.76 52790
186.222.9.89 37524
180.199.181.162 31573
109.63.197.122 6881
88.206.85.61 11789
109.197.128.119 35691
109.65.151.224 22686
24.139.75.159 55215
68.52.52.15 50017
124.121.50.231 47353
27.9.150.248 45913
178.149.6.45 43642
80.195.253.210 36134
112.165.56.205 38376
62.151.135.200 60153
122.39.214.154 51539

View File

@ -0,0 +1,60 @@
#include "bitdht/bdiface.h"
#include "bitdht/bdstddht.h"
#include "bdhandler.h"
#include "bootstrap_fn.h"
bool bdSingleShotFindPeer(const std::string bootstrapfile, const std::string peerId, std::string &peer_ip, uint16_t &peer_port)
{
/* startup dht : with a random id! */
bdNodeId ownId;
bdStdRandomNodeId(&ownId);
uint16_t port = 6775;
std::string appId = "bsId";
BitDhtHandler dht(&ownId, port, appId, bootstrapfile);
/* install search node */
bdNodeId searchId;
bdStdRandomNodeId(&searchId);
std::cerr << "bssdht: searching for Id: ";
bdStdPrintNodeId(std::cerr, &searchId);
std::cerr << std::endl;
dht.FindNode(&searchId);
/* run your program */
bdId resultId;
uint32_t status;
resultId.id = searchId;
while(false == dht.SearchResult(&resultId, status))
{
sleep(10);
}
std::cerr << "bdSingleShotFindPeer(): Found Result:" << std::endl;
std::cerr << "\tId: ";
bdStdPrintId(std::cerr, &resultId);
std::cerr << std::endl;
std::cerr << "\tstatus: " << status;
std::cerr << std::endl;
dht.shutdown();
return true;
}

View File

@ -0,0 +1,17 @@
#include <string>
#include <inttypes.h>
/* NOTE. At the moment only the bootstrapfile is actually used.
* peerId is ignored (a random peerId is searched for). ip & port are not filled in either.
*
* This is mainly to finish testing.
*
* Once the best form of the return functions is decided (ipv4 structure, or strings).
* this can be finished off.
*
*/
bool bdSingleShotFindPeer(const std::string bootstrapfile, const std::string peerId, std::string &ip, uint16_t &port);

View File

@ -1,50 +1,22 @@
#include "bitdht/bdiface.h"
#include "bitdht/bdstddht.h"
#include "bdhandler.h"
#include "bootstrap_fn.h"
#include <iostream>
#include <inttypes.h>
int main(int argc, char **argv)
{
/* startup dht : with a random id! */
bdNodeId ownId;
bdStdRandomNodeId(&ownId);
uint16_t port = 6775;
std::string appId = "bsId";
std::string bootstrapfile = "bdboot.txt";
std::string peerId;
std::string ip;
uint16_t port;
BitDhtHandler dht(&ownId, port, appId, bootstrapfile);
/* install search node */
bdNodeId searchId;
bdStdRandomNodeId(&searchId);
std::cerr << "bssdht: searching for Id: ";
bdStdPrintNodeId(std::cerr, &searchId);
std::cerr << "bssdht: starting up";
std::cerr << std::endl;
dht.FindNode(&searchId);
bdSingleShotFindPeer(bootstrapfile, peerId, ip, port);
/* run your program */
bdId resultId;
uint32_t status;
resultId.id = searchId;
while(false == dht.SearchResult(&resultId, status))
{
sleep(10);
}
std::cerr << "bssdht: Found Result:" << std::endl;
std::cerr << "\tId: ";
bdStdPrintId(std::cerr, &resultId);
std::cerr << std::endl;
std::cerr << "\tstatus: " << status;
std::cerr << "bssdht: finished";
std::cerr << std::endl;
return 1;