Skip to content

Rarest set of pieces is replaced with set of rarest pieces indexes#211

Open
Dead-off wants to merge 107 commits into
mpetazzoni:masterfrom
Dead-off:master
Open

Rarest set of pieces is replaced with set of rarest pieces indexes#211
Dead-off wants to merge 107 commits into
mpetazzoni:masterfrom
Dead-off:master

Conversation

@Dead-off

Copy link
Copy Markdown
Collaborator

Fix memory leak. It is not a good idea to change field which is used in compareTo and use this object in sorted set. It turns out the set may not find such object after modification, which leads to memory leak when object is added to the set again.
Also we can replace delete-add modify of this set with only add

pankdm and others added 30 commits April 10, 2013 12:37
…sage.parse

Order of the parameters to the HTTPAnnounceRequestMessage constructor was incorrect in the parse() method. Thanks to Dan Oxlade for reporting the problem.

Closes mpetazzoni#48.

Signed-off-by: Maxime Petazzoni <maxime.petazzoni@bulix.org>
Allow trackerless torrent files mpetazzoni#2

Signed-off-by: Maxime Petazzoni <maxime.petazzoni@bulix.org>
…h InboundThread and OutboundThread to a common ExchangeThread superclass.
Add ability to set upload/download rate limits.

Signed-off-by: Maxime Petazzoni <maxime.petazzoni@bulix.org>
Signed-off-by: Maxime Petazzoni <maxime.petazzoni@bulix.org>
Fix read when message size wasn't read in one step

Signed-off-by: Maxime Petazzoni <maxime.petazzoni@bulix.org>
BDecode support for negative integers

Signed-off-by: Maxime Petazzoni <maxime.petazzoni@bulix.org>
Fixes bug with selecting the announce client

A previous change introduced a bug in the selection
of the announce tier and client. Closes mpetazzoni#51.

Signed-off-by: Maxime Petazzoni <maxime.petazzoni@bulix.org>
Use maven-shade-plugin to produce executable jar

Signed-off-by: Maxime Petazzoni <maxime.petazzoni@bulix.org>
Update pom for compatibility with the maven-release-plugin

Signed-off-by: Maxime Petazzoni <maxime.petazzoni@bulix.org>
Clean up javadoc problems

Signed-off-by: Maxime Petazzoni <maxime.petazzoni@bulix.org>
Shell script updates for wider platform compatibility

Signed-off-by: Maxime Petazzoni <maxime.petazzoni@bulix.org>
Move entry-point main methods to separate package

Signed-off-by: Maxime Petazzoni <maxime.petazzoni@bulix.org>
philipphenkel and others added 26 commits January 20, 2016 20:30
Remove dependency on Apache comons-codec
…eerexchange

Allow immedidate shutdown of peerexchange by notifying out-going thread
This change prevents the modification of a storage file in case the
file is already complete and all pieces are available.
…zoni#169

Signed-off-by: Maxime Petazzoni <maxime.petazzoni@bulix.org>
Signed-off-by: Maxime Petazzoni <maxime.petazzoni@bulix.org>
…ng-file-only-if-required

Change the length of an existing storage file only if required
Signed-off-by: Maxime Petazzoni <maxime.petazzoni@bulix.org>
In preparation of incoming 1.5 release, with the cli/core split.

Signed-off-by: Maxime Petazzoni <maxime.petazzoni@bulix.org>
Signed-off-by: Maxime Petazzoni <maxime.petazzoni@bulix.org>
Signed-off-by: Maxime Petazzoni <maxime.petazzoni@bulix.org>
The old implementation of byteArrayToHexString drops the byte array’s
leading zeros.
…tring

Fix byteArrayToHexString and add tests
Unchoke the random peer in optimistic unchoking
Fixed a BufferUnderflowException in message parsing when PeerExchange is closing
…in compareTo and use this object in sorted set. It turns out the set may not find such object after modification, which leads to memory leak when object is added to the set again.

@mpetazzoni mpetazzoni left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Just a few nits

import java.util.List;
import java.util.SortedSet;
import java.util.TreeSet;
import java.util.*;

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't use import *

"that was already requested from another peer.");
}

SortedSet<Piece> rarest = new TreeSet<Piece>();

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a fan of the field hiding. Could you name the sorted set rarestPieces instead?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, i did not notice. Fixed

this.initialized = false;
this.pieces = new Piece[0];
this.rarest = Collections.synchronizedSortedSet(new TreeSet<Piece>());
this.rarest = new HashSet<Integer>();

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, don't you also need to make this a synchronized set?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not needed, because rarest field is always used in synchronized functions

…ield have same name. Replaced import * with single class imports
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.