You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm setting up a local test based on StressTest.cs. I subscribed to event handlers, and noticed that each peer was trying and failing to connect to themself. Example output -
After some debugging, I realized that AnnounceResponse's peers PeerInfo.PeerId is empty. When created on the Tracker at SimpleTorrentManager.GetPeers, with compact=1 the PeerId isn't included. In TorrentManager.AddPeer, this check then doesn't get hit -
if (Engine!.PeerId.Equals (peer.Info.PeerId))
return false;
Which results in the torrent manager adding itself as a peer.
I think a proper fix would be to include the PeerId in the compact byte[].
For a workaround I extended HttpTrackerListener, turning off "compact"
private class NonCompactHttpTrackerListener : HttpTrackerListener
{
public NonCompactHttpTrackerListener( string httpPrefix ) : base( httpPrefix )
{
}
public override BEncodedDictionary Handle( NameValueCollection collection, IPAddress remoteAddress, bool isScrape )
{
collection[ "compact" ] = "0"; // don't compact the peers, it results in missing data which causes peers to try to connect to themself (and fail)
return base.Handle( collection, remoteAddress, isScrape );
}
}
The text was updated successfully, but these errors were encountered:
I'm setting up a local test based on
StressTest.cs
. I subscribed to event handlers, and noticed that each peer was trying and failing to connect to themself. Example output -After some debugging, I realized that
AnnounceResponse
's peersPeerInfo.PeerId
is empty. When created on the Tracker atSimpleTorrentManager.GetPeers
, withcompact=1
the PeerId isn't included. InTorrentManager.AddPeer
, this check then doesn't get hit -Which results in the torrent manager adding itself as a peer.
I think a proper fix would be to include the PeerId in the compact byte[].
For a workaround I extended
HttpTrackerListener
, turning off "compact"The text was updated successfully, but these errors were encountered: