Trace browser state, transfer I/O and daemon PID
This commit is contained in:
1 parent
aca10e8268
commit
0706ccce8a
3 files changed
+39
-4
No files matched your search
@@ -140,11 +140,18 @@ void MemberFileBrowser::updateActions() {
|
||||
}
|
||||
|
||||
bool MemberFileBrowser::post(mf_message& message) {
|
||||
if (!m_group || !server() || !gui_bridge_is_uasync_ready()) return false;
|
||||
if (!m_group || !server() || !gui_bridge_is_uasync_ready()) {
|
||||
DEBUG_DEBUG(DEBUG_CATEGORY_DEBUG, "member_files: GUI post rejected cmd=%s group=%llx server=%llx ready=%d",
|
||||
mf_command_text(message.command), (unsigned long long)m_group, (unsigned long long)server(), gui_bridge_is_uasync_ready());
|
||||
return false;
|
||||
}
|
||||
auto* q = (mf_gui_request*)u_calloc(1, sizeof(mf_gui_request));
|
||||
if (!q) { DEBUG_ERROR(DEBUG_CATEGORY_MEDIA, "file browser: request allocation failed"); return false; }
|
||||
message.request_id = requestId(); message.kind = MF_REQUEST;
|
||||
q->inst = gui_bridge_get_inst(); q->group = m_group; q->server = server(); q->message = message;
|
||||
DEBUG_DEBUG(DEBUG_CATEGORY_DEBUG, "member_files: GUI post id=%llu cmd=%s group=%llx server=%llx owner=%llx path=%s",
|
||||
(unsigned long long)message.request_id, mf_command_text(message.command), (unsigned long long)m_group,
|
||||
(unsigned long long)server(), (unsigned long long)message.owner, message.path);
|
||||
gui_bridge_post_uasync_fn(member_files_gui_request, q); return true;
|
||||
}
|
||||
|
||||
@@ -156,6 +163,8 @@ void MemberFileBrowser::cancelRequest(quint64 id) {
|
||||
}
|
||||
|
||||
void MemberFileBrowser::refresh() {
|
||||
DEBUG_DEBUG(DEBUG_CATEGORY_DEBUG, "member_files: GUI refresh old_id=%llu group=%llx server=%llx owner=%llx path=%s",
|
||||
(unsigned long long)m_listId, (unsigned long long)m_group, (unsigned long long)server(), (unsigned long long)owner(), qPrintable(m_path));
|
||||
cancelRequest(m_listId); m_listId = 0; m_entries->clear(); m_location->setText(m_path); updateActions();
|
||||
if (!server()) { m_status->setText(text("No media server in this group")); return; }
|
||||
mf_message q{}; q.command = MF_LIST; q.owner = owner();
|
||||
@@ -180,8 +189,17 @@ void MemberFileBrowser::enter(QTreeWidgetItem* item) {
|
||||
}
|
||||
|
||||
void MemberFileBrowser::onResponse(const uint8_t* data, int length) {
|
||||
if (length < 16 || mf_get64(data) != m_group || mf_get64(data + 8) != server()) return;
|
||||
if (!data || length < 16) { DEBUG_DEBUG(DEBUG_CATEGORY_DEBUG, "member_files: GUI short response bytes=%d", length); return; }
|
||||
if (mf_get64(data) != m_group || mf_get64(data + 8) != server()) {
|
||||
DEBUG_DEBUG(DEBUG_CATEGORY_DEBUG, "member_files: GUI response ignored context group=%llx/%llx server=%llx/%llx",
|
||||
(unsigned long long)mf_get64(data), (unsigned long long)m_group,
|
||||
(unsigned long long)mf_get64(data + 8), (unsigned long long)server());
|
||||
return;
|
||||
}
|
||||
mf_message r{}; if (mf_decode(data + 16, (size_t)length - 16, &r)) return;
|
||||
DEBUG_DEBUG(DEBUG_CATEGORY_DEBUG, "member_files: GUI response id=%llu list_id=%llu cmd=%s status=%s bytes=%u owner=%llx/%llx path=%s",
|
||||
(unsigned long long)r.request_id, (unsigned long long)m_listId, mf_command_text(r.command), mf_status_text(r.status), r.data_len,
|
||||
(unsigned long long)r.owner, (unsigned long long)owner(), r.path);
|
||||
if (r.request_id == m_listId && r.owner == owner() && QString::fromUtf8(r.path) == m_path) {
|
||||
if (r.status) {
|
||||
m_listId = 0;
|
||||
@@ -211,10 +229,16 @@ void MemberFileBrowser::onResponse(const uint8_t* data, int length) {
|
||||
} else {
|
||||
m_listId = 0; m_entries->setSortingEnabled(true); m_entries->sortItems(0, Qt::AscendingOrder);
|
||||
m_status->setText(text("%1 entries").arg(m_entries->topLevelItemCount())); updateActions();
|
||||
DEBUG_DEBUG(DEBUG_CATEGORY_DEBUG, "member_files: GUI directory ready id=%llu entries=%d",
|
||||
(unsigned long long)r.request_id, m_entries->topLevelItemCount());
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (!m_actions.contains(r.request_id)) return;
|
||||
if (!m_actions.contains(r.request_id)) {
|
||||
DEBUG_DEBUG(DEBUG_CATEGORY_DEBUG, "member_files: GUI response ignored stale id=%llu cmd=%s",
|
||||
(unsigned long long)r.request_id, mf_command_text(r.command));
|
||||
return;
|
||||
}
|
||||
uint8_t command = m_actions.take(r.request_id);
|
||||
if (r.status && r.status != MF_CANCELLED) { QMessageBox::warning(this, text("Group files"), QString::fromUtf8(mf_status_text(r.status))); return; }
|
||||
if (command == MF_STAT && !r.status) {
|
||||
|
||||
Reference in new issue
Block a user