diff mbox series

[v3] obexd: Fix can't receive small files sent by windows

Message ID 20220329020247.28885-1-wangxinpeng@uniontech.com (mailing list archive)
State Superseded
Headers show
Series [v3] obexd: Fix can't receive small files sent by windows | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success
tedd_an/checkpatch warning [v3] obexd: Fix can't receive small files sent by windows WARNING:COMMIT_LOG_LONG_LINE: Possible unwrapped commit description (prefer a maximum 75 chars per line) #65: that requests the file path has not been processed. This will cause the upper /github/workspace/src/12794376.patch total: 0 errors, 1 warnings, 20 lines checked NOTE: For some of the reported defects, checkpatch may be able to mechanically convert to the typical style using --fix or --fix-inplace. /github/workspace/src/12794376.patch has style problems, please review. NOTE: Ignored message types: COMMIT_MESSAGE COMPLEX_MACRO CONST_STRUCT FILE_PATH_CHANGES MISSING_SIGN_OFF PREFER_PACKED SPDX_LICENSE_TAG SPLIT_STRING SSCANF_TO_KSTRTO NOTE: If any of the errors are false positives, please report them to the maintainer, see CHECKPATCH in MAINTAINERS.
tedd_an/gitlint success Gitlint PASS
tedd_an/setupell success Setup ELL PASS
tedd_an/buildprep success Build Prep PASS
tedd_an/build success Build Configuration PASS
tedd_an/makecheck success Make Check PASS
tedd_an/makecheckvalgrind success Make Check PASS
tedd_an/makedistcheck success Make Distcheck PASS
tedd_an/build_extell success Build External ELL PASS
tedd_an/build_extell_make success Build Make with External ELL PASS

Commit Message

xinpeng wang March 29, 2022, 2:02 a.m. UTC
When obexd receives a file, it parses the filename and other parameters
when processing the packet for the first time, store filename in
obex_session and emit the dbus signal, The signal will be pending first.
then when this file is received, transfer_complete reset obex_session
is called.

When using a computer with Windows 10 installed to send a file to bluez,
obexd will read the data through read_stream; if it is a small file, the
data processed for the first time is marked as final, and transfer_complete
reset obex_session will be called when the data is processed for the first
time. At this point, the dbus signal is still pending, and the dbus method
that requests the file path has not been processed. This will cause the upper
application to not be able to transfer files from the cache directory to the
directory specified by the user.

To solve this problem, emit Filename's dbus signal and force it when
status=active.

Ways to reproduce the problem:
1. Use the computer with windows 10 installed to send a small file to the
computer with ubuntu installed;
2. file size < 10k;
3. After sending, in most cases, the file is located in the ~/.cache/obexd/
directory. Normally, the file should be located in the ~/Download directory.

To fix this, after applying this commit, it also needs to be modified by
the upper-level application. Modified to read Filename from dbus signal if
there is Filename in dbus signal. Otherwise, use the dbus method to request
Filename.
---
v3: Remove the Signed-off-by in commit msg.

 obexd/src/manager.c | 6 +++++-
 obexd/src/obex.c    | 1 +
 2 files changed, 6 insertions(+), 1 deletion(-)

Comments

bluez.test.bot@gmail.com March 29, 2022, 4:23 a.m. UTC | #1
This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=627050

---Test result---

Test Summary:
CheckPatch                    FAIL      1.48 seconds
GitLint                       PASS      1.07 seconds
Prep - Setup ELL              PASS      55.34 seconds
Build - Prep                  PASS      0.92 seconds
Build - Configure             PASS      10.68 seconds
Build - Make                  PASS      1903.01 seconds
Make Check                    PASS      13.46 seconds
Make Check w/Valgrind         PASS      553.87 seconds
Make Distcheck                PASS      292.66 seconds
Build w/ext ELL - Configure   PASS      10.68 seconds
Build w/ext ELL - Make        PASS      1867.38 seconds
Incremental Build with patchesPASS      0.00 seconds

Details
##############################
Test: CheckPatch - FAIL
Desc: Run checkpatch.pl script with rule in .checkpatch.conf
Output:
[v3] obexd: Fix can't receive small files sent by windows
WARNING:COMMIT_LOG_LONG_LINE: Possible unwrapped commit description (prefer a maximum 75 chars per line)
#65: 
that requests the file path has not been processed. This will cause the upper

/github/workspace/src/12794376.patch total: 0 errors, 1 warnings, 20 lines checked

NOTE: For some of the reported defects, checkpatch may be able to
      mechanically convert to the typical style using --fix or --fix-inplace.

/github/workspace/src/12794376.patch has style problems, please review.

NOTE: Ignored message types: COMMIT_MESSAGE COMPLEX_MACRO CONST_STRUCT FILE_PATH_CHANGES MISSING_SIGN_OFF PREFER_PACKED SPDX_LICENSE_TAG SPLIT_STRING SSCANF_TO_KSTRTO

NOTE: If any of the errors are false positives, please report
      them to the maintainer, see CHECKPATCH in MAINTAINERS.




---
Regards,
Linux Bluetooth
diff mbox series

Patch

diff --git a/obexd/src/manager.c b/obexd/src/manager.c
index 01741fe62..2c180dc44 100644
--- a/obexd/src/manager.c
+++ b/obexd/src/manager.c
@@ -533,8 +533,12 @@  void manager_emit_transfer_property(struct obex_transfer *transfer,
 void manager_emit_transfer_started(struct obex_transfer *transfer)
 {
 	transfer->status = TRANSFER_STATUS_ACTIVE;
+	if (!transfer->path)
+		return;
 
-	manager_emit_transfer_property(transfer, "Status");
+	g_dbus_emit_property_changed_full(connection, transfer->path,
+					TRANSFER_INTERFACE, "Status",
+					G_DBUS_PROPERTY_CHANGED_FLAG_FLUSH);
 }
 
 static void emit_transfer_completed(struct obex_transfer *transfer,
diff --git a/obexd/src/obex.c b/obexd/src/obex.c
index 3a68fd66c..c0d9e160a 100644
--- a/obexd/src/obex.c
+++ b/obexd/src/obex.c
@@ -720,6 +720,7 @@  int obex_put_stream_start(struct obex_session *os, const char *filename)
 		manager_emit_transfer_property(os->service_data, "Size");
 
 	os->path = g_strdup(filename);
+	manager_emit_transfer_property(os->service_data, "Filename");
 
 	return 0;
 }