mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-11-27 14:32:06 +01:00
Fallback works like a charm
This commit is contained in:
parent
4a8251fbe5
commit
63aa2f017c
2 changed files with 4 additions and 3 deletions
|
@ -55,13 +55,14 @@ public class ReceiveTask implements Runnable {
|
||||||
|
|
||||||
byte[] filebuf = new byte[transfer.getSize()];
|
byte[] filebuf = new byte[transfer.getSize()];
|
||||||
int read = 0;
|
int read = 0;
|
||||||
byte[] bufbuf = new byte[2048];
|
byte[] bufbuf = new byte[4096];
|
||||||
LOGGER.log(Level.INFO, "Begin receiving.");
|
LOGGER.log(Level.INFO, "Begin receiving bytes.");
|
||||||
while (read < filebuf.length) {
|
while (read < filebuf.length) {
|
||||||
int r = inputStream.read(bufbuf);
|
int r = inputStream.read(bufbuf);
|
||||||
if (r >= 0) {
|
if (r >= 0) {
|
||||||
System.arraycopy(bufbuf, 0, filebuf, read, r);
|
System.arraycopy(bufbuf, 0, filebuf, read, r);
|
||||||
read += r;
|
read += r;
|
||||||
|
LOGGER.log(Level.INFO, "Read " + r + " (" + read + " of " + filebuf.length + ") bytes.");
|
||||||
} else {
|
} else {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,6 +58,7 @@ public class SendTask implements Runnable {
|
||||||
|
|
||||||
LOGGER.log(Level.INFO, "WRITE");
|
LOGGER.log(Level.INFO, "WRITE");
|
||||||
outputStream.write(filebuf);
|
outputStream.write(filebuf);
|
||||||
|
outputStream.flush();
|
||||||
LOGGER.log(Level.INFO, "WRITING FINISHED");
|
LOGGER.log(Level.INFO, "WRITING FINISHED");
|
||||||
}
|
}
|
||||||
catch (IOException e) {
|
catch (IOException e) {
|
||||||
|
@ -70,7 +71,6 @@ public class SendTask implements Runnable {
|
||||||
inputStream.close();
|
inputStream.close();
|
||||||
LOGGER.log(Level.INFO, "InputStream closed.");
|
LOGGER.log(Level.INFO, "InputStream closed.");
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
LOGGER.log(Level.SEVERE, "Could not close session.", e);
|
LOGGER.log(Level.SEVERE, "Could not close session.", e);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue