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
@@ -63,6 +63,8 @@ static void transfer_finish(struct mf_transfer* t, int status) {
|
||||
|
||||
static void transfer_work(void* arg) {
|
||||
struct mf_transfer* t = arg;
|
||||
DEBUG_TRACE(DEBUG_CATEGORY_DEBUG, "member_files: local I/O start transfer=%llu work=%d fd=%d offset=%llu bytes=%u",
|
||||
(unsigned long long)t->request.id, t->work, t->fd, (unsigned long long)t->offset, t->bytes);
|
||||
t->work_status = MF_OK;
|
||||
if (t->work == TRANSFER_PREPARE) {
|
||||
if (t->request.upload) {
|
||||
@@ -113,6 +115,8 @@ static void transfer_release(struct mf_transfer* t) {
|
||||
|
||||
static void transfer_done(void* arg, int error) {
|
||||
struct mf_transfer* t = arg; t->busy = 0;
|
||||
DEBUG_DEBUG(DEBUG_CATEGORY_DEBUG, "member_files: local I/O done transfer=%llu work=%d status=%s error=%d cancelled=%d",
|
||||
(unsigned long long)t->request.id, t->work, mf_status_text(t->work_status), error, t->cancelled);
|
||||
int status = error ? MF_CANCELLED : t->work_status;
|
||||
if (t->work == TRANSFER_FINISH) {
|
||||
/* При destroy work могла быть завершена, а completion отменён. fd уже закрыт. */
|
||||
@@ -143,6 +147,9 @@ static void transfer_submit(struct mf_transfer* t, enum transfer_work work) {
|
||||
|
||||
static void transfer_response(void* arg, const struct mf_message* r) {
|
||||
struct mf_transfer* t = arg; t->pending = NULL;
|
||||
DEBUG_DEBUG(DEBUG_CATEGORY_DEBUG, "member_files: transfer response transfer=%llu request=%llu cmd=%s status=%s offset=%llu bytes=%u",
|
||||
(unsigned long long)t->request.id, (unsigned long long)r->request_id, mf_command_text(r->command), mf_status_text(r->status),
|
||||
(unsigned long long)r->offset, r->data_len);
|
||||
if (t->cancelled || t->files->closing || r->status) { transfer_finish(t, r->status ? r->status : MF_CANCELLED); return; }
|
||||
if (r->command == MF_STAT) {
|
||||
if (r->type != MF_FILE || r->size > INT64_MAX || mf_zero(r->version, 16)) { transfer_finish(t, MF_INVALID_RANGE); return; }
|
||||
@@ -180,7 +187,7 @@ static void transfer_send(struct mf_transfer* t, uint8_t command) {
|
||||
static void transfer_connected(struct CONN_MGR_HANDLE* h, uint64_t peer, uint64_t group, enum conn_mgr_event event, void* arg) {
|
||||
(void)h; (void)peer; (void)group;
|
||||
struct mf_transfer* t = arg;
|
||||
DEBUG_DEBUG(DEBUG_CATEGORY_MEDIA, "member_files: transfer CM id=%llu event=%d", (unsigned long long)t->request.id, event);
|
||||
DEBUG_DEBUG(DEBUG_CATEGORY_DEBUG, "member_files: transfer CM id=%llu event=%d", (unsigned long long)t->request.id, event);
|
||||
}
|
||||
|
||||
void member_files_gui_transfer(void* arg) {
|
||||
@@ -215,6 +222,8 @@ void member_files_gui_transfer(void* arg) {
|
||||
static void transfer_cancel(struct mf_transfer* t) {
|
||||
if (t->cancelled || t->work == TRANSFER_FINISH) return;
|
||||
t->cancelled = 1; t->status = MF_CANCELLED;
|
||||
DEBUG_DEBUG(DEBUG_CATEGORY_DEBUG, "member_files: transfer cancel id=%llu busy=%d pending=%p work=%d",
|
||||
(unsigned long long)t->request.id, t->busy, (void*)t->pending, t->work);
|
||||
if (t->pending) member_files_cancel(t->pending);
|
||||
else if (!t->busy) transfer_finish(t, MF_CANCELLED);
|
||||
}
|
||||
|
||||
@@ -415,6 +415,8 @@ int main(int argc, char *argv[]) {
|
||||
uasync_destroy(ua, 0); main_ua = NULL;
|
||||
return 1;
|
||||
}
|
||||
DEBUG_DEBUG(DEBUG_CATEGORY_DEBUG, "member_files startup: core initialized pid=%ld foreground=%d ua=%p files=%p",
|
||||
(long)getpid(), args.foreground, (void*)ua, (void*)instance->member_files);
|
||||
|
||||
// Note: TUN socket is registered in tun_init(), ETCP sockets in init_connections()
|
||||
|
||||
|
||||
Reference in new issue
Block a user