public void announce ( final AnnounceRequestMessage . RequestEvent event , boolean inhibitEvents , final AnnounceableInformation torrentInfo , final List < Peer > adresses ) throws AnnounceException { logAnnounceRequest ( event , torrentInfo ) ; final List < HTTPTrackerMessage > trackerResponses = new ArrayList < HTTPTrackerMessage > ( ) ; for ( final Peer address : adresses ) { final URL target = encodeAnnounceToURL ( event , torrentInfo , address ) ; try { sendAnnounce ( target , "GET" , new ResponseParser ( ) { @ Override public void parse ( InputStream inputStream , int responseCode ) throws IOException , MessageValidationException { if ( responseCode != 200 ) { logger . info ( "received not http 200 code from tracker for request " + target ) ; return ; } trackerResponses . add ( HTTPTrackerMessage . parse ( inputStream ) ) ; } } ) ; } catch ( ConnectException e ) { throw new AnnounceException ( e . getMessage ( ) , e ) ; } } // we process only first request: if ( trackerResponses . size ( ) > 0 ) { final HTTPTrackerMessage message = trackerResponses . get ( 0 ) ; this . handleTrackerAnnounceResponse ( message , inhibitEvents , torrentInfo . getHexInfoHash ( ) ) ; } }
Build send and process a tracker announce request .