Skip to content

Commit

Permalink
merged pull request mpetazzoni#60
Browse files Browse the repository at this point in the history
  • Loading branch information
Dead-off committed Jun 27, 2018
1 parent 0f9a379 commit f76694d
Showing 1 changed file with 6 additions and 2 deletions.
Expand Up @@ -93,6 +93,10 @@ public static HTTPAnnounceResponseMessage parse(BEValue decoded)

Map<String, BEValue> params = decoded.getMap();

if (params.get("interval") == null) {
throw new MessageValidationException("Tracker message missing mandatory field 'interval'!");
}

try {
List<Peer> peers;

Expand All @@ -109,8 +113,8 @@ public static HTTPAnnounceResponseMessage parse(BEValue decoded)
if (params.get("torrentIdentifier") != null) {
return new HTTPAnnounceResponseMessage(Constants.EMPTY_BUFFER,
params.get("interval").getInt(),
params.get("complete").getInt(),
params.get("incomplete").getInt(),
params.get("complete") != null ? params.get("complete").getInt() : 0,
params.get("incomplete") != null ? params.get("incomplete").getInt() : 0,
peers, params.get("torrentIdentifier").getString());
} else {
return new HTTPAnnounceResponseMessage(Constants.EMPTY_BUFFER,
Expand Down

0 comments on commit f76694d

Please sign in to comment.