Skip to content
This repository has been archived by the owner on Apr 22, 2021. It is now read-only.

Commit

Permalink
Fix: division per zero
Browse files Browse the repository at this point in the history
  • Loading branch information
Laurent Clouet committed Sep 12, 2020
1 parent 17d45f6 commit eae4b5b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/com/sheepit/client/Server.java
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,8 @@ else if (this.client.getRenderingJob().isUserBlockJob()) {
gui_.displayTransferStats(dlStats, ulStats);
gui_.status(status_, 100, size);

this.log.debug(String.format("File downloaded at %.1f KB/s, written %d bytes", (float) (size/1024) / duration.getSeconds(), written));
this.log.debug(String.format("File downloaded at %s/s, written %d bytes", new TransferStats(size, duration.getSeconds() + 1).getAverageSessionSpeed(), written));

this.lastRequestTime = new Date().getTime();

return Error.Type.OK;
Expand Down Expand Up @@ -525,7 +526,7 @@ public ServerCode HTTPSendFile(String surl, String file1, int checkpoint, Gui gu
this.ulStats.calc(fileHandler.length(), ((duration.getSeconds() * 1000) + (duration.getNano() / 1000000)));
gui.displayTransferStats(dlStats, ulStats);

this.log.debug(String.format("File uploaded at %s/s, uploaded %d bytes", Utils.formatDataConsumption((long) fileHandler.length() / duration.getSeconds()), fileHandler.length()));
this.log.debug(String.format("File uploaded at %s/s, uploaded %d bytes", new TransferStats(fileHandler.length(), duration.getSeconds() + 1).getAverageSessionSpeed(), fileHandler.length()));

int r = response.code();
String contentType = response.body().contentType().toString();
Expand Down

0 comments on commit eae4b5b

Please sign in to comment.