Skip to content

Commit 32fb906

Browse files
committed
FIX: calling incrementing two times for having skipped bytes
1 parent de92c03 commit 32fb906

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>com.genonbeta.coolsocket</groupId>
88
<artifactId>main</artifactId>
9-
<version>1.0.1.2</version>
9+
<version>1.0.1.4</version>
1010
<name>CoolSocket</name>
1111
<description>Socket implementation</description>
1212
<url>https://github.com/genonbeta/CoolSocket</url>

src/main/java/com/genonbeta/CoolSocket/CoolTransfer.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,8 @@ public void skipBytes(long bytes) throws IOException
243243
@Override
244244
public void run()
245245
{
246+
getTransferProgress().resetCurrentTransferredByte();
247+
246248
setStatus(Status.RUNNING);
247249
onRun();
248250
setStatus(Status.INTERRUPTED);
@@ -314,7 +316,6 @@ protected void onRun()
314316
long lastRead = System.currentTimeMillis();
315317

316318
onOrientatingStreams(this, inputStream, getOutputStream());
317-
getTransferProgress().resetCurrentTransferredByte();
318319

319320
while (len != -1) {
320321
synchronized (getBlockingObject()) {
@@ -443,7 +444,6 @@ public Handler(String serverIp, int port, InputStream stream, long fileSize, byt
443444
protected void onRun()
444445
{
445446
addProcess(this);
446-
447447
setFlag(onStart(this));
448448

449449
try {
@@ -460,8 +460,6 @@ protected void onRun()
460460
int len = 0;
461461

462462
onOrientatingStreams(this, getInputStream(), outputStream);
463-
getTransferProgress().resetCurrentTransferredByte();
464-
getTransferProgress().incrementTransferredByte(getSkippedBytes());
465463

466464
while (len != -1) {
467465
synchronized (getBlockingObject()) {

0 commit comments

Comments
 (0)