#xi4 Stuck here because the test case seems to time out for some reason

I’m stuck on Stage #(xi4) because the test cases are timing out, I am not certain where the following is going wrong

Here are my logs:

A%2F%2F127.0.0.1:34319%2Fannounce"
[tester::#XI4] Tracker started on address 127.0.0.1:34319...
[tester::#XI4] 
[tester::#XI4] Peer listening on address: 127.0.0.1:41577
[tester::#XI4] Waiting to receive handshake message
[tester::#XI4] Received handshake: [infohash: ad42ce8109f54c99613ce38f9b4d87e70f24a165, peer_id: 2d5043303030312d766679665558696379325442]
[tester::#XI4] 
[tester::#XI4] Sending back handshake with peer_id: 655df499a29247c98c62f45bdb307ea4b2d400ac
[tester::#XI4] Sending bitfield message
[tester::#XI4] Sending extension handshake
[tester::#XI4] Waiting to receive extension handshake message
[your_program] 68
[your_program] message is <Buffer 05 e0>
[tester::#XI4] Received extension handshake with payload: d1:md11:ut_metadatai1e6:ut_pexi2eee
[tester::#XI4] Checking metadata extension id received
[tester::#XI4] timed out, test exceeded 10 seconds
[tester::#XI4] Test failed

And here’s a snippet of my code: Rest of the code is committed

  else if (command === "magnet_handshake"){
    const magLink = process.argv[3]
    const magnetParser = new MagnetParser(magLink)
    const p2pClient = new PeerCommunication(magnetParser)

    const peer = (await magnetParser.getPeers())[0]
    
    let {client, response} = await p2pClient.initiateHandShake(peer)
    console.log(response.length)
    const msg = await p2pClient.waitForBitField(client)

    console.log("message is", msg)
    const reserved = response.subarray(20, 28)
    if (reserved[5] & 0x10) {
      const bdict = bencode({m : {ut_metadata : 1, ut_pex : 2}})
      p2pClient.createExtensionHandshake(client, Buffer.from(bdict, "binary"))

      const { blockData} = await p2pClient.waitForExtensionHandshake(client);
    }

    client.destroy()
    client = null

    p2pClient.printPeerId(peer)

  }

Hey @abhishek-7901, the timeout is caused by the extra handshake at the end:

thanks brother, silly from my end

1 Like

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.