diff options
author | Anders Petersson <anders3.petersson@sonyericsson.com> | 2010-10-27 08:38:30 +0200 |
---|---|---|
committer | Jaikumar Ganesh <jaikumar@google.com> | 2010-10-27 16:13:59 -0700 |
commit | 4507b177c35cfd918dba1cdc325fae3688fb7bd2 (patch) | |
tree | a8465a750da0f44f2ebc2485fe8a2de805cf1f58 /obex | |
parent | ee1dc6221fc9193fb135386244e61e557a07260d (diff) | |
download | frameworks_base-4507b177c35cfd918dba1cdc325fae3688fb7bd2.zip frameworks_base-4507b177c35cfd918dba1cdc325fae3688fb7bd2.tar.gz frameworks_base-4507b177c35cfd918dba1cdc325fae3688fb7bd2.tar.bz2 |
Bluetooth OBEX timeout problem.
Long time to show notification of file transfer failed after
canceling transfer via remote part.
Device A is in contact with our device, B. When device A Cancel
a transfer operation, it sends OBEX_OPCODE_DISCONNECT HeaderID
and the length of package to B. B use the length of package to
read remainder bytes from A. If the bytes B read do not meet the
received length it will block and wait for remainder bytes from A.
But when B compute the remainder bytes it forgets to subtract
the three bytes it has already read through HeaderID and the length
of the package. So the operation was blocked until the operation
timeout.
Change-Id: I0f8bf62d3119e081b5c01af9fc05fe586fd4fabc
Diffstat (limited to 'obex')
-rw-r--r-- | obex/javax/obex/ServerOperation.java | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/obex/javax/obex/ServerOperation.java b/obex/javax/obex/ServerOperation.java index 07a3a53..d1476d2 100644 --- a/obex/javax/obex/ServerOperation.java +++ b/obex/javax/obex/ServerOperation.java @@ -397,11 +397,13 @@ public final class ServerOperation implements Operation, BaseStream { && (headerID != ObexHelper.OBEX_OPCODE_GET_FINAL)) { if (length > 3) { - byte[] temp = new byte[length]; + byte[] temp = new byte[length - 3]; + // First three bytes already read, compensating for this bytesReceived = mInput.read(temp); - while (bytesReceived != length) { - bytesReceived += mInput.read(temp, bytesReceived, length - bytesReceived); + while (bytesReceived != temp.length) { + bytesReceived += mInput.read(temp, bytesReceived, + temp.length - bytesReceived); } } |