Skip to content

debug: 添加 LIST 命令数据发送详细日志#23

Merged
hxcan merged 2 commits into
masterfrom
debug/list-sending-content
Mar 31, 2026
Merged

debug: 添加 LIST 命令数据发送详细日志#23
hxcan merged 2 commits into
masterfrom
debug/list-sending-content

Conversation

@sisterfuture

Copy link
Copy Markdown
Collaborator

调试目的

排查 list_ftp_directory 工具与 hxftpserver 的兼容性问题。

新增日志

1. 每行构造完成时

📤 [CONSTRUCT] Line constructed: [-rw-rw-rw- 1 ChenXin cx 12345 Mar 31 14:42 filename.txt] (length=67)

2. 发送单文件时

📤 [SINGLE FILE] Sending bytes (69): 2D 72 77 ... 0D 0A
📤 [SINGLE FILE] Sending text: [-rw-rw-rw- 1 ChenXin cx 12345 Mar 31 14:42 filename.txt\r\n]

3. 发送目录列表时(每个文件)

📤 [DIR LOOP] Sending bytes (69): 2D 72 77 ... 0D 0A
📤 [DIR LOOP] Sending text: [-rw-rw-rw- 1 ChenXin cx 12345 Mar 31 14:42 filename.txt\r\n]

4. 最终换行符

📤 [FINAL] Writing final \r\n terminator (2 bytes: 0D 0A)

日志格式说明

  • Hex Dump: 显示每个字节的十六进制值,包括 0D 0A (\r\n)
  • Text View: 显示可读的文本内容,\r\n 明确标出
  • Length: 显示每行的字节长度

测试步骤

  1. 合并此 PR
  2. 重新编译 hxftpserver APK
  3. 安装到手机并启动 FTP 服务器(端口 26738)
  4. 使用 list_ftp_directory 工具连接并列出目录
  5. 查看日志文件:/storage/emulated/0/Download/sisterfuture_logs/zixunwangjuan.rs.d
  6. 搜索 📤 表情符号找到所有发送日志

预期结果

能够看到:

  • 每一行目录列表的完整内容
  • 实际的换行符 (\r\n = 0D 0A)
  • 总共发送了多少字节
  • 是否有额外的空行格式问题

关联 Issue: list_ftp_directory 工具返回空列表问题

- Log the exact content being sent to data socket including \\r\\n
- Log each line constructed by construct1LineListFile() with visible line endings
- Log final \\r\\n terminator separately
- Helps debug list_ftp_directory tool compatibility issues
…restore full file

This reverts the previous commit which accidentally replaced the entire file.
Now correctly restoring the complete DirectoryListSender.java with only the debug logging additions.
@hxcan hxcan merged commit 463e693 into master Mar 31, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants