Skip to content

Commit

Permalink
FIX: calling incrementing two times for having skipped bytes
Browse files Browse the repository at this point in the history
  • Loading branch information
velitasali committed Sep 7, 2018
1 parent de92c03 commit 32fb906
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>com.genonbeta.coolsocket</groupId>
<artifactId>main</artifactId>
<version>1.0.1.2</version>
<version>1.0.1.4</version>
<name>CoolSocket</name>
<description>Socket implementation</description>
<url>https://github.com/genonbeta/CoolSocket</url>
Expand Down
6 changes: 2 additions & 4 deletions src/main/java/com/genonbeta/CoolSocket/CoolTransfer.java
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,8 @@ public void skipBytes(long bytes) throws IOException
@Override
public void run()
{
getTransferProgress().resetCurrentTransferredByte();

setStatus(Status.RUNNING);
onRun();
setStatus(Status.INTERRUPTED);
Expand Down Expand Up @@ -314,7 +316,6 @@ protected void onRun()
long lastRead = System.currentTimeMillis();

onOrientatingStreams(this, inputStream, getOutputStream());
getTransferProgress().resetCurrentTransferredByte();

while (len != -1) {
synchronized (getBlockingObject()) {
Expand Down Expand Up @@ -443,7 +444,6 @@ public Handler(String serverIp, int port, InputStream stream, long fileSize, byt
protected void onRun()
{
addProcess(this);

setFlag(onStart(this));

try {
Expand All @@ -460,8 +460,6 @@ protected void onRun()
int len = 0;

onOrientatingStreams(this, getInputStream(), outputStream);
getTransferProgress().resetCurrentTransferredByte();
getTransferProgress().incrementTransferredByte(getSkippedBytes());

while (len != -1) {
synchronized (getBlockingObject()) {
Expand Down

0 comments on commit 32fb906

Please sign in to comment.