Fallback works like a charm

This commit is contained in:
vanitasvitae 2017-07-03 10:13:00 +02:00
parent 4a8251fbe5
commit 63aa2f017c
Signed by: vanitasvitae
GPG Key ID: 62BEE9264BF17311
2 changed files with 4 additions and 3 deletions

View File

@ -55,13 +55,14 @@ public class ReceiveTask implements Runnable {
byte[] filebuf = new byte[transfer.getSize()];
int read = 0;
byte[] bufbuf = new byte[2048];
LOGGER.log(Level.INFO, "Begin receiving.");
byte[] bufbuf = new byte[4096];
LOGGER.log(Level.INFO, "Begin receiving bytes.");
while (read < filebuf.length) {
int r = inputStream.read(bufbuf);
if (r >= 0) {
System.arraycopy(bufbuf, 0, filebuf, read, r);
read += r;
LOGGER.log(Level.INFO, "Read " + r + " (" + read + " of " + filebuf.length + ") bytes.");
} else {
break;
}

View File

@ -58,6 +58,7 @@ public class SendTask implements Runnable {
LOGGER.log(Level.INFO, "WRITE");
outputStream.write(filebuf);
outputStream.flush();
LOGGER.log(Level.INFO, "WRITING FINISHED");
}
catch (IOException e) {
@ -70,7 +71,6 @@ public class SendTask implements Runnable {
inputStream.close();
LOGGER.log(Level.INFO, "InputStream closed.");
}
} catch (IOException e) {
LOGGER.log(Level.SEVERE, "Could not close session.", e);
}