~motu-torrent/azureus/upstream-stable

« back to all changes in this revision

Viewing changes to org/gudy/azureus2/core3/tracker/client/impl/dht/TRTrackerDHTAnnouncerImpl.java

  • Committer: John Dong
  • Date: 2007-10-22 04:54:13 UTC
  • Revision ID: john.dong@gmail.com-20071022045413-3ovb11u82rrcokxx
Commit 3.0.3.4

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * Created on 14-Feb-2005
3
 
 * Created by Paul Gardner
4
 
 * Copyright (C) 2004, 2005, 2006 Aelitis, All Rights Reserved.
5
 
 *
6
 
 * This program is free software; you can redistribute it and/or
7
 
 * modify it under the terms of the GNU General Public License
8
 
 * as published by the Free Software Foundation; either version 2
9
 
 * of the License, or (at your option) any later version.
10
 
 * This program is distributed in the hope that it will be useful,
11
 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 
 * GNU General Public License for more details.
14
 
 * You should have received a copy of the GNU General Public License
15
 
 * along with this program; if not, write to the Free Software
16
 
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
17
 
 * 
18
 
 * AELITIS, SAS au capital de 46,603.30 euros
19
 
 * 8 Allee Lenotre, La Grille Royale, 78600 Le Mesnil le Roi, France.
20
 
 *
21
 
 */
22
 
 
23
 
package org.gudy.azureus2.core3.tracker.client.impl.dht;
24
 
 
25
 
import java.net.URL;
26
 
 
27
 
 
28
 
import org.gudy.azureus2.core3.internat.MessageText;
29
 
import org.gudy.azureus2.core3.logging.*;
30
 
import org.gudy.azureus2.core3.torrent.TOTorrent;
31
 
import org.gudy.azureus2.core3.torrent.TOTorrentException;
32
 
import org.gudy.azureus2.core3.tracker.client.TRTrackerAnnouncer;
33
 
import org.gudy.azureus2.core3.tracker.client.TRTrackerAnnouncerDataProvider;
34
 
import org.gudy.azureus2.core3.tracker.client.TRTrackerAnnouncerException;
35
 
import org.gudy.azureus2.core3.tracker.client.TRTrackerAnnouncerResponse;
36
 
import org.gudy.azureus2.core3.tracker.client.TRTrackerAnnouncerResponsePeer;
37
 
import org.gudy.azureus2.core3.tracker.client.impl.TRTrackerAnnouncerImpl;
38
 
import org.gudy.azureus2.core3.tracker.client.impl.TRTrackerAnnouncerResponseImpl;
39
 
import org.gudy.azureus2.core3.tracker.client.impl.TRTrackerAnnouncerResponsePeerImpl;
40
 
import org.gudy.azureus2.core3.util.Debug;
41
 
import org.gudy.azureus2.core3.util.HashWrapper;
42
 
import org.gudy.azureus2.core3.util.SystemTime;
43
 
import org.gudy.azureus2.plugins.clientid.ClientIDException;
44
 
import org.gudy.azureus2.plugins.download.DownloadAnnounceResult;
45
 
import org.gudy.azureus2.plugins.download.DownloadAnnounceResultPeer;
46
 
import org.gudy.azureus2.pluginsimpl.local.clientid.ClientIDManagerImpl;
47
 
 
48
 
/**
49
 
 * @author parg
50
 
 *
51
 
 */
52
 
 
53
 
public class 
54
 
TRTrackerDHTAnnouncerImpl
55
 
        extends TRTrackerAnnouncerImpl
56
 
{
57
 
        private TOTorrent               torrent;
58
 
        private HashWrapper             torrent_hash;
59
 
        private byte[]                  data_peer_id;
60
 
        
61
 
        private String                                          tracker_status_str;
62
 
        private long                                            last_update_time;
63
 
        
64
 
        private int                                                     state = TS_INITIALISED;
65
 
        
66
 
        private TRTrackerAnnouncerResponseImpl  last_response;
67
 
        
68
 
        private boolean                 manual;
69
 
        
70
 
        public
71
 
        TRTrackerDHTAnnouncerImpl(
72
 
                TOTorrent               _torrent,
73
 
                String[]                _networks,
74
 
                boolean                 _manual )
75
 
        
76
 
                throws TRTrackerAnnouncerException
77
 
        {
78
 
                super( _torrent );
79
 
                
80
 
                torrent         = _torrent;
81
 
                manual          = _manual;
82
 
                
83
 
                try{
84
 
                        torrent_hash    = torrent.getHashWrapper();
85
 
                        
86
 
                }catch( TOTorrentException e ){
87
 
                        
88
 
                        Debug.printStackTrace(e);
89
 
                }
90
 
                try{
91
 
                        data_peer_id = ClientIDManagerImpl.getSingleton().generatePeerID( torrent, false );
92
 
                        
93
 
                }catch( ClientIDException e ){
94
 
 
95
 
                         throw( new TRTrackerAnnouncerException( "TRTrackerAnnouncer: Peer ID generation fails", e ));
96
 
                }
97
 
                
98
 
                last_response = 
99
 
                        new TRTrackerAnnouncerResponseImpl( 
100
 
                                torrent.getAnnounceURL(),
101
 
                                torrent_hash,
102
 
                                TRTrackerAnnouncerResponse.ST_OFFLINE, 0, "Initialising" );
103
 
                
104
 
                tracker_status_str = MessageText.getString("PeerManager.status.checking") + "...";
105
 
        }
106
 
        
107
 
        public void
108
 
        setAnnounceDataProvider(
109
 
                TRTrackerAnnouncerDataProvider          provider )
110
 
        {
111
 
                
112
 
        }
113
 
        
114
 
        public boolean
115
 
        isManual()
116
 
        {
117
 
                return( manual );
118
 
        }
119
 
        
120
 
        public TOTorrent
121
 
        getTorrent()
122
 
        {
123
 
                return( torrent );
124
 
        }
125
 
        
126
 
        public URL
127
 
        getTrackerUrl()
128
 
        {
129
 
                return( torrent.getAnnounceURL());
130
 
        }
131
 
        
132
 
        public void
133
 
        setTrackerUrl(
134
 
                URL             url )
135
 
        {
136
 
                Debug.out( "setTrackerURL not supported for DHT" );
137
 
        }
138
 
                
139
 
        public void
140
 
        resetTrackerUrl(
141
 
                boolean shuffle )
142
 
        {
143
 
        }
144
 
        
145
 
        public void
146
 
        cloneFrom(
147
 
                TRTrackerAnnouncer      other )
148
 
        {
149
 
                data_peer_id    = other.getPeerId();
150
 
        }
151
 
        
152
 
        public void
153
 
        setIPOverride(
154
 
                String          override )
155
 
        {
156
 
        }
157
 
        
158
 
        public void
159
 
        clearIPOverride()
160
 
        {
161
 
        }
162
 
                        
163
 
        public int
164
 
        getPort()
165
 
        {
166
 
                return(0);
167
 
        }
168
 
        
169
 
        public byte[]
170
 
        getPeerId()
171
 
        {
172
 
                return( data_peer_id );
173
 
        }
174
 
        
175
 
        public void
176
 
        setRefreshDelayOverrides(
177
 
                int             percentage )
178
 
        {
179
 
        }
180
 
        
181
 
        public int
182
 
        getTimeUntilNextUpdate()
183
 
        {
184
 
                long elapsed = (SystemTime.getCurrentTime() - last_update_time)/1000;
185
 
                
186
 
                return( (int)(last_response.getTimeToWait()-elapsed));
187
 
        }
188
 
        
189
 
        public int
190
 
        getLastUpdateTime()
191
 
        {
192
 
                return( (int)(last_update_time/1000));
193
 
        }
194
 
                        
195
 
        public void
196
 
        update(
197
 
                boolean force )
198
 
        {
199
 
                state = TS_DOWNLOADING;
200
 
                
201
 
                checkCache();
202
 
        }       
203
 
        
204
 
        public void
205
 
        complete(
206
 
                boolean already_reported )
207
 
        {
208
 
                state   = TS_COMPLETED;
209
 
        }
210
 
        
211
 
        public void
212
 
        stop(
213
 
                boolean for_queue )
214
 
        {
215
 
                state   = TS_STOPPED;
216
 
        }
217
 
        
218
 
        public void
219
 
        destroy()
220
 
        {
221
 
        }
222
 
        
223
 
        public int
224
 
        getStatus()
225
 
        {
226
 
                return( state );
227
 
        }
228
 
        
229
 
        public String
230
 
        getStatusString()
231
 
        {
232
 
                return( tracker_status_str );
233
 
        }
234
 
        
235
 
        public TRTrackerAnnouncerResponse
236
 
        getLastResponse()
237
 
        {
238
 
                return( last_response );
239
 
        }
240
 
        
241
 
        public void
242
 
        refreshListeners()
243
 
        {       
244
 
        }
245
 
        
246
 
        public void
247
 
        setAnnounceResult(
248
 
                DownloadAnnounceResult  result )
249
 
        {
250
 
                last_update_time        = SystemTime.getCurrentTime();
251
 
                
252
 
                TRTrackerAnnouncerResponseImpl response;
253
 
                
254
 
                if ( result.getResponseType() == DownloadAnnounceResult.RT_ERROR ){
255
 
                        
256
 
                        tracker_status_str = MessageText.getString("PeerManager.status.error"); 
257
 
                      
258
 
                        String  reason = result.getError();
259
 
        
260
 
                        if ( reason != null ){
261
 
                
262
 
                                tracker_status_str += " (" + reason + ")";              
263
 
                        }
264
 
                        
265
 
                        response = new TRTrackerAnnouncerResponseImpl(
266
 
                                                                result.getURL(),
267
 
                                                                torrent_hash,
268
 
                                                                TRTrackerAnnouncerResponse.ST_OFFLINE, 
269
 
                                                                result.getTimeToWait(), 
270
 
                                                                reason );
271
 
                }else{
272
 
                        DownloadAnnounceResultPeer[]    ext_peers = result.getPeers();
273
 
                        
274
 
                        TRTrackerAnnouncerResponsePeerImpl[] peers = new TRTrackerAnnouncerResponsePeerImpl[ext_peers.length];
275
 
                                
276
 
                        for (int i=0;i<ext_peers.length;i++){
277
 
                                
278
 
                                DownloadAnnounceResultPeer      ext_peer        = ext_peers[i];
279
 
                                
280
 
                                if (Logger.isEnabled())
281
 
                                        Logger.log(new LogEvent(torrent, LOGID, "EXTERNAL PEER DHT: ip="
282
 
                                                        + ext_peer.getAddress() + ",port=" + ext_peer.getPort() +",prot=" + ext_peer.getProtocol()));
283
 
 
284
 
                                int             http_port       = 0;
285
 
                                byte    az_version      = TRTrackerAnnouncer.AZ_TRACKER_VERSION_1;
286
 
                                
287
 
                                peers[i] = new TRTrackerAnnouncerResponsePeerImpl( 
288
 
                                                                        ext_peer.getSource(),
289
 
                                                                        ext_peer.getPeerID(),
290
 
                                                                        ext_peer.getAddress(), 
291
 
                                                                        ext_peer.getPort(),
292
 
                                                                        ext_peer.getUDPPort(),
293
 
                                                                        http_port,
294
 
                                                                        ext_peer.getProtocol(),
295
 
                                                                        az_version,
296
 
                                                                        (short)0 );
297
 
                        }
298
 
                        
299
 
                        addToTrackerCache( peers);
300
 
                
301
 
                        tracker_status_str = MessageText.getString("PeerManager.status.ok");
302
 
 
303
 
                        response = new TRTrackerAnnouncerResponseImpl( result.getURL(), torrent_hash, TRTrackerAnnouncerResponse.ST_ONLINE, result.getTimeToWait(), peers );
304
 
                }
305
 
                
306
 
                last_response = response;
307
 
                                
308
 
                listeners.dispatch( LDT_TRACKER_RESPONSE, response );
309
 
        }
310
 
        
311
 
        protected void
312
 
        checkCache()
313
 
        {
314
 
                if ( last_response.getStatus() != TRTrackerAnnouncerResponse.ST_ONLINE ){
315
 
                        
316
 
                     TRTrackerAnnouncerResponsePeer[]   cached_peers = getPeersFromCache(100);
317
 
 
318
 
                     if ( cached_peers.length > 0 ){
319
 
                        
320
 
                        last_response.setPeers( cached_peers );
321
 
                        
322
 
                                listeners.dispatch( LDT_TRACKER_RESPONSE, last_response );
323
 
                     }
324
 
                }
325
 
        }
326
 
}
 
1
/*
 
2
 * Created on 14-Feb-2005
 
3
 * Created by Paul Gardner
 
4
 * Copyright (C) 2004, 2005, 2006 Aelitis, All Rights Reserved.
 
5
 *
 
6
 * This program is free software; you can redistribute it and/or
 
7
 * modify it under the terms of the GNU General Public License
 
8
 * as published by the Free Software Foundation; either version 2
 
9
 * of the License, or (at your option) any later version.
 
10
 * This program is distributed in the hope that it will be useful,
 
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
13
 * GNU General Public License for more details.
 
14
 * You should have received a copy of the GNU General Public License
 
15
 * along with this program; if not, write to the Free Software
 
16
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
17
 * 
 
18
 * AELITIS, SAS au capital de 46,603.30 euros
 
19
 * 8 Allee Lenotre, La Grille Royale, 78600 Le Mesnil le Roi, France.
 
20
 *
 
21
 */
 
22
 
 
23
package org.gudy.azureus2.core3.tracker.client.impl.dht;
 
24
 
 
25
import java.net.URL;
 
26
 
 
27
 
 
28
import org.gudy.azureus2.core3.internat.MessageText;
 
29
import org.gudy.azureus2.core3.logging.*;
 
30
import org.gudy.azureus2.core3.torrent.TOTorrent;
 
31
import org.gudy.azureus2.core3.torrent.TOTorrentException;
 
32
import org.gudy.azureus2.core3.tracker.client.TRTrackerAnnouncer;
 
33
import org.gudy.azureus2.core3.tracker.client.TRTrackerAnnouncerDataProvider;
 
34
import org.gudy.azureus2.core3.tracker.client.TRTrackerAnnouncerException;
 
35
import org.gudy.azureus2.core3.tracker.client.TRTrackerAnnouncerResponse;
 
36
import org.gudy.azureus2.core3.tracker.client.TRTrackerAnnouncerResponsePeer;
 
37
import org.gudy.azureus2.core3.tracker.client.impl.TRTrackerAnnouncerImpl;
 
38
import org.gudy.azureus2.core3.tracker.client.impl.TRTrackerAnnouncerResponseImpl;
 
39
import org.gudy.azureus2.core3.tracker.client.impl.TRTrackerAnnouncerResponsePeerImpl;
 
40
import org.gudy.azureus2.core3.util.Debug;
 
41
import org.gudy.azureus2.core3.util.HashWrapper;
 
42
import org.gudy.azureus2.core3.util.IndentWriter;
 
43
import org.gudy.azureus2.core3.util.SystemTime;
 
44
import org.gudy.azureus2.plugins.clientid.ClientIDException;
 
45
import org.gudy.azureus2.plugins.download.DownloadAnnounceResult;
 
46
import org.gudy.azureus2.plugins.download.DownloadAnnounceResultPeer;
 
47
import org.gudy.azureus2.pluginsimpl.local.clientid.ClientIDManagerImpl;
 
48
 
 
49
/**
 
50
 * @author parg
 
51
 *
 
52
 */
 
53
 
 
54
public class 
 
55
TRTrackerDHTAnnouncerImpl
 
56
        extends TRTrackerAnnouncerImpl
 
57
{
 
58
        private TOTorrent               torrent;
 
59
        private HashWrapper             torrent_hash;
 
60
        private byte[]                  data_peer_id;
 
61
        
 
62
        private String                                          tracker_status_str;
 
63
        private long                                            last_update_time;
 
64
        
 
65
        private int                                                     state = TS_INITIALISED;
 
66
        
 
67
        private TRTrackerAnnouncerResponseImpl  last_response;
 
68
        
 
69
        private boolean                 manual;
 
70
        
 
71
        public
 
72
        TRTrackerDHTAnnouncerImpl(
 
73
                TOTorrent               _torrent,
 
74
                String[]                _networks,
 
75
                boolean                 _manual )
 
76
        
 
77
                throws TRTrackerAnnouncerException
 
78
        {
 
79
                super( _torrent );
 
80
                
 
81
                torrent         = _torrent;
 
82
                manual          = _manual;
 
83
                
 
84
                try{
 
85
                        torrent_hash    = torrent.getHashWrapper();
 
86
                        
 
87
                }catch( TOTorrentException e ){
 
88
                        
 
89
                        Debug.printStackTrace(e);
 
90
                }
 
91
                try{
 
92
                        data_peer_id = ClientIDManagerImpl.getSingleton().generatePeerID( torrent, false );
 
93
                        
 
94
                }catch( ClientIDException e ){
 
95
 
 
96
                         throw( new TRTrackerAnnouncerException( "TRTrackerAnnouncer: Peer ID generation fails", e ));
 
97
                }
 
98
                
 
99
                last_response = 
 
100
                        new TRTrackerAnnouncerResponseImpl( 
 
101
                                torrent.getAnnounceURL(),
 
102
                                torrent_hash,
 
103
                                TRTrackerAnnouncerResponse.ST_OFFLINE, 0, "Initialising" );
 
104
                
 
105
                tracker_status_str = MessageText.getString("PeerManager.status.checking") + "...";
 
106
        }
 
107
        
 
108
        public void
 
109
        setAnnounceDataProvider(
 
110
                TRTrackerAnnouncerDataProvider          provider )
 
111
        {
 
112
                
 
113
        }
 
114
        
 
115
        public boolean
 
116
        isManual()
 
117
        {
 
118
                return( manual );
 
119
        }
 
120
        
 
121
        public TOTorrent
 
122
        getTorrent()
 
123
        {
 
124
                return( torrent );
 
125
        }
 
126
        
 
127
        public URL
 
128
        getTrackerUrl()
 
129
        {
 
130
                return( torrent.getAnnounceURL());
 
131
        }
 
132
        
 
133
        public void
 
134
        setTrackerUrl(
 
135
                URL             url )
 
136
        {
 
137
                Debug.out( "setTrackerURL not supported for DHT" );
 
138
        }
 
139
                
 
140
        public void
 
141
        resetTrackerUrl(
 
142
                boolean shuffle )
 
143
        {
 
144
        }
 
145
        
 
146
        public void
 
147
        cloneFrom(
 
148
                TRTrackerAnnouncer      other )
 
149
        {
 
150
                data_peer_id    = other.getPeerId();
 
151
        }
 
152
        
 
153
        public void
 
154
        setIPOverride(
 
155
                String          override )
 
156
        {
 
157
        }
 
158
        
 
159
        public void
 
160
        clearIPOverride()
 
161
        {
 
162
        }
 
163
                        
 
164
        public int
 
165
        getPort()
 
166
        {
 
167
                return(0);
 
168
        }
 
169
        
 
170
        public byte[]
 
171
        getPeerId()
 
172
        {
 
173
                return( data_peer_id );
 
174
        }
 
175
        
 
176
        public void
 
177
        setRefreshDelayOverrides(
 
178
                int             percentage )
 
179
        {
 
180
        }
 
181
        
 
182
        public int
 
183
        getTimeUntilNextUpdate()
 
184
        {
 
185
                long elapsed = (SystemTime.getCurrentTime() - last_update_time)/1000;
 
186
                
 
187
                return( (int)(last_response.getTimeToWait()-elapsed));
 
188
        }
 
189
        
 
190
        public int
 
191
        getLastUpdateTime()
 
192
        {
 
193
                return( (int)(last_update_time/1000));
 
194
        }
 
195
                        
 
196
        public void
 
197
        update(
 
198
                boolean force )
 
199
        {
 
200
                state = TS_DOWNLOADING;
 
201
                
 
202
                checkCache();
 
203
        }       
 
204
        
 
205
        public void
 
206
        complete(
 
207
                boolean already_reported )
 
208
        {
 
209
                state   = TS_COMPLETED;
 
210
        }
 
211
        
 
212
        public void
 
213
        stop(
 
214
                boolean for_queue )
 
215
        {
 
216
                state   = TS_STOPPED;
 
217
        }
 
218
        
 
219
        public void
 
220
        destroy()
 
221
        {
 
222
        }
 
223
        
 
224
        public int
 
225
        getStatus()
 
226
        {
 
227
                return( state );
 
228
        }
 
229
        
 
230
        public String
 
231
        getStatusString()
 
232
        {
 
233
                return( tracker_status_str );
 
234
        }
 
235
        
 
236
        public TRTrackerAnnouncerResponse
 
237
        getLastResponse()
 
238
        {
 
239
                return( last_response );
 
240
        }
 
241
        
 
242
        public void
 
243
        refreshListeners()
 
244
        {       
 
245
        }
 
246
        
 
247
        public void
 
248
        setAnnounceResult(
 
249
                DownloadAnnounceResult  result )
 
250
        {
 
251
                last_update_time        = SystemTime.getCurrentTime();
 
252
                
 
253
                TRTrackerAnnouncerResponseImpl response;
 
254
                
 
255
                if ( result.getResponseType() == DownloadAnnounceResult.RT_ERROR ){
 
256
                        
 
257
                        tracker_status_str = MessageText.getString("PeerManager.status.error"); 
 
258
                      
 
259
                        String  reason = result.getError();
 
260
        
 
261
                        if ( reason != null ){
 
262
                
 
263
                                tracker_status_str += " (" + reason + ")";              
 
264
                        }
 
265
                        
 
266
                        response = new TRTrackerAnnouncerResponseImpl(
 
267
                                                                result.getURL(),
 
268
                                                                torrent_hash,
 
269
                                                                TRTrackerAnnouncerResponse.ST_OFFLINE, 
 
270
                                                                result.getTimeToWait(), 
 
271
                                                                reason );
 
272
                }else{
 
273
                        DownloadAnnounceResultPeer[]    ext_peers = result.getPeers();
 
274
                        
 
275
                        TRTrackerAnnouncerResponsePeerImpl[] peers = new TRTrackerAnnouncerResponsePeerImpl[ext_peers.length];
 
276
                                
 
277
                        for (int i=0;i<ext_peers.length;i++){
 
278
                                
 
279
                                DownloadAnnounceResultPeer      ext_peer        = ext_peers[i];
 
280
                                
 
281
                                if (Logger.isEnabled())
 
282
                                        Logger.log(new LogEvent(torrent, LOGID, "EXTERNAL PEER DHT: ip="
 
283
                                                        + ext_peer.getAddress() + ",port=" + ext_peer.getPort() +",prot=" + ext_peer.getProtocol()));
 
284
 
 
285
                                int             http_port       = 0;
 
286
                                byte    az_version      = TRTrackerAnnouncer.AZ_TRACKER_VERSION_1;
 
287
                                
 
288
                                peers[i] = new TRTrackerAnnouncerResponsePeerImpl( 
 
289
                                                                        ext_peer.getSource(),
 
290
                                                                        ext_peer.getPeerID(),
 
291
                                                                        ext_peer.getAddress(), 
 
292
                                                                        ext_peer.getPort(),
 
293
                                                                        ext_peer.getUDPPort(),
 
294
                                                                        http_port,
 
295
                                                                        ext_peer.getProtocol(),
 
296
                                                                        az_version,
 
297
                                                                        (short)0 );
 
298
                        }
 
299
                        
 
300
                        addToTrackerCache( peers);
 
301
                
 
302
                        tracker_status_str = MessageText.getString("PeerManager.status.ok");
 
303
 
 
304
                        response = new TRTrackerAnnouncerResponseImpl( result.getURL(), torrent_hash, TRTrackerAnnouncerResponse.ST_ONLINE, result.getTimeToWait(), peers );
 
305
                }
 
306
                
 
307
                last_response = response;
 
308
                                
 
309
                listeners.dispatch( LDT_TRACKER_RESPONSE, response );
 
310
        }
 
311
        
 
312
        protected void
 
313
        checkCache()
 
314
        {
 
315
                if ( last_response.getStatus() != TRTrackerAnnouncerResponse.ST_ONLINE ){
 
316
                        
 
317
                     TRTrackerAnnouncerResponsePeer[]   cached_peers = getPeersFromCache(100);
 
318
 
 
319
                     if ( cached_peers.length > 0 ){
 
320
                        
 
321
                        last_response.setPeers( cached_peers );
 
322
                        
 
323
                                listeners.dispatch( LDT_TRACKER_RESPONSE, last_response );
 
324
                     }
 
325
                }
 
326
        }
 
327
        
 
328
        public void 
 
329
        generateEvidence(
 
330
                IndentWriter writer )
 
331
        {
 
332
                writer.println( "DHT announce: " + (last_response==null?"null":last_response.getString()));
 
333
        }
 
334
}