cheogram-android
created pr with
cheogram-android/fix-jft.1
changed pr name to
Fix Jingle File Transfer
cmds
checkout latest patchset:
ssh pr.pico.sh pull cheogram-android:fix-jft | git am -3checkout specific patchset revision:
ssh pr.pico.sh pull cheogram-android:fix-jft [rev] | git am -3add changes to patch request:
git format-patch main --stdout | ssh pr.pico.sh cheogram-android:fix-jftadd comment to patch request:
ssh pr.pico.sh comment cheogram-android:fix-jft "lgtm!"
Patchset
cheogram-android/fix-jft.1
Compile time option to force IBB, for testing
Stephen Paul Weber
Fix compile time option to force diable HTTP upload, for testing
2026-11-18T21:36:05ZStephen Paul Weber
→ Send IBB close properly when done
2026-11-18T21:36:19ZStephen Paul Weber
Bigger IBB block size
2026-11-18T21:37:01ZStephen Paul Weber
Don't choke when optional type attribute is missing
2026-11-18T21:37:19ZStephen Paul Weber
2026-11-18T21:37:27Z
Send IBB close properly when done
Stephen Paul Weber
2026-11-18T21:37:01ZDiff stat
3 files changed, 29 insertions(+)
Semantic diff summary
0 added,
0 modified,
0 signature changed,
0 removed
across 0 analyzed files
(3 files skipped: unsupported file type)
+4
-0
src/main/java/eu/siacs/conversations/xmpp/jingle/JingleFileTransferConnection.java
#
| ... | ... | @@ -909,6 +909,10 @@ public class JingleFileTransferConnection extends AbstractJingleConnection | |
| 909 | 909 | private void onFileTransmissionComplete(final List<FileTransferDescription.Hash> hashes) { | |
| 910 | 910 | // TODO if we ever support receiving files this should become isSending(); isReceiving() | |
| 911 | 911 | if (isInitiator()) { | |
| 912 | + | final var transport = this.transport; | |
| 913 | + | if (transport != null) { | |
| 914 | + | transport.finishSending(); | |
| 915 | + | } | |
| 912 | 916 | sendSessionInfoChecksum(hashes); | |
| 913 | 917 | } else { | |
| 914 | 918 | Log.d(Config.LOGTAG, "file transfer complete " + hashes); |
+23
-0
src/main/java/eu/siacs/conversations/xmpp/jingle/transports/InbandBytestreamsTransport.java
#
| ... | ... | @@ -55,6 +55,8 @@ public class InbandBytestreamsTransport implements Transport { | |
| 55 | 55 | ||
| 56 | 56 | private final AtomicBoolean isReceiving = new AtomicBoolean(false); | |
| 57 | 57 | ||
| 58 | + | private volatile OutputStream sendingOutputStream; | |
| 59 | + | ||
| 58 | 60 | public InbandBytestreamsTransport( | |
| 59 | 61 | final XmppConnection xmppConnection, final Jid with, final boolean initiator) { | |
| 60 | 62 | this(xmppConnection, with, initiator, UUID.randomUUID().toString(), DEFAULT_BLOCK_SIZE); |
| ... | ... | @@ -197,9 +199,19 @@ public class InbandBytestreamsTransport implements Transport { | |
| 197 | 199 | public OutputStream getOutputStream() throws IOException { | |
| 198 | 200 | final var outputStream = new PipedOutputStream(); | |
| 199 | 201 | this.pipedInputStream.connect(outputStream); | |
| 202 | + | this.sendingOutputStream = outputStream; | |
| 200 | 203 | return outputStream; | |
| 201 | 204 | } | |
| 202 | 205 | ||
| 206 | + | @Override | |
| 207 | + | public void finishSending() { | |
| 208 | + | final var outputStream = this.sendingOutputStream; | |
| 209 | + | if (outputStream != null) { | |
| 210 | + | closeQuietly(outputStream); | |
| 211 | + | this.sendingOutputStream = null; | |
| 212 | + | } | |
| 213 | + | } | |
| 214 | + | ||
| 203 | 215 | @Override | |
| 204 | 216 | public InputStream getInputStream() throws IOException { | |
| 205 | 217 | final var inputStream = new PipedInputStream(); |
| ... | ... | @@ -264,6 +276,9 @@ public class InbandBytestreamsTransport implements Transport { | |
| 264 | 276 | final int count = this.inputStream.read(buffer); | |
| 265 | 277 | if (count < 0) { | |
| 266 | 278 | Log.d(Config.LOGTAG, "block sender reached EOF"); | |
| 279 | + | if (isSending.get()) { | |
| 280 | + | sendClose(); | |
| 281 | + | } | |
| 267 | 282 | return; | |
| 268 | 283 | } | |
| 269 | 284 | this.semaphore.acquire(); |
| ... | ... | @@ -303,6 +318,14 @@ public class InbandBytestreamsTransport implements Transport { | |
| 303 | 318 | }); | |
| 304 | 319 | } | |
| 305 | 320 | ||
| 321 | + | private void sendClose() { | |
| 322 | + | final var iqPacket = new Iq(Iq.Type.SET); | |
| 323 | + | iqPacket.setTo(with); | |
| 324 | + | final var close = iqPacket.addChild("close", Namespace.IBB); | |
| 325 | + | close.setAttribute("sid", this.streamId); | |
| 326 | + | this.xmppConnection.sendIqPacket(iqPacket, null); | |
| 327 | + | } | |
| 328 | + | ||
| 306 | 329 | @Override | |
| 307 | 330 | public void close() { | |
| 308 | 331 | this.isSending.set(false); |