diff options
author | Christian Grothoff <christian@grothoff.org> | 2006-12-10 05:56:51 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2006-12-10 05:56:51 +0000 |
commit | 738b5eba3f7eb5daadef7c1d19e338a198cb2b48 (patch) | |
tree | e10c9467e983b60f4baead9f6575c1f21211ea42 | |
parent | 9774be8bee108a7824775cd97b43ea5fe7b194ff (diff) | |
download | gnunet-gtk-738b5eba3f7eb5daadef7c1d19e338a198cb2b48.tar.gz gnunet-gtk-738b5eba3f7eb5daadef7c1d19e338a198cb2b48.zip |
fixing deadlock, more remaining
-rw-r--r-- | TODO | 5 | ||||
-rw-r--r-- | src/plugins/fs/download.c | 39 | ||||
-rw-r--r-- | src/plugins/fs/search.c | 9 | ||||
-rw-r--r-- | src/plugins/fs/upload.c | 1 |
4 files changed, 42 insertions, 12 deletions
@@ -1,4 +1,6 @@ | |||
1 | 0.7.1: | 1 | 0.7.1: |
2 | - deadlock: FSUI_startDownload/Upload | ||
3 | must NOT be done in main thread [pre2] | ||
2 | - fix addition of previews for uploads [pre2] | 4 | - fix addition of previews for uploads [pre2] |
3 | - create directory from known file IDs [ medium ] [pre2] | 5 | - create directory from known file IDs [ medium ] [pre2] |
4 | in Assemble Directory's Files Available/Selected | 6 | in Assemble Directory's Files Available/Selected |
@@ -14,9 +16,6 @@ | |||
14 | + collection abortion | 16 | + collection abortion |
15 | 17 | ||
16 | ODD BUGS TO WATCH OUT FOR (seen, possibly fixed, hard to reproduce): | 18 | ODD BUGS TO WATCH OUT FOR (seen, possibly fixed, hard to reproduce): |
17 | - deadlock (download directory, download files in | ||
18 | directory, clear (multiple) completed downloads | ||
19 | => strange deadlock) | ||
20 | - Assertion failed at download.c:264 in fs_download_started. | 19 | - Assertion failed at download.c:264 in fs_download_started. |
21 | 20 | ||
22 | 0.7.2: | 21 | 0.7.2: |
diff --git a/src/plugins/fs/download.c b/src/plugins/fs/download.c index e5e16ab0..eab6ed20 100644 --- a/src/plugins/fs/download.c +++ b/src/plugins/fs/download.c | |||
@@ -99,7 +99,10 @@ refreshDirectoryViewFromDisk(DownloadList * list) { | |||
99 | unsigned long long size; | 99 | unsigned long long size; |
100 | char * data; | 100 | char * data; |
101 | int fd; | 101 | int fd; |
102 | char * fn; | ||
102 | struct ECRS_MetaData * meta; | 103 | struct ECRS_MetaData * meta; |
104 | struct stat buf; | ||
105 | const char * f; | ||
103 | 106 | ||
104 | if ( (list->is_directory != YES) || | 107 | if ( (list->is_directory != YES) || |
105 | (list->searchList == NULL) || | 108 | (list->searchList == NULL) || |
@@ -107,18 +110,37 @@ refreshDirectoryViewFromDisk(DownloadList * list) { | |||
107 | (! gtk_tree_row_reference_valid(list->searchViewRowReference)) ) | 110 | (! gtk_tree_row_reference_valid(list->searchViewRowReference)) ) |
108 | return; | 111 | return; |
109 | 112 | ||
110 | if (OK != disk_file_size(ectx, | 113 | if (0 != stat(list->filename, |
111 | list->filename, | 114 | &buf)) |
112 | &size, | ||
113 | YES)) | ||
114 | return; | 115 | return; |
115 | if (size == 0) | 116 | if (S_ISDIR(buf.st_mode)) { |
117 | fn = MALLOC(strlen(list->filename) + strlen(GNUNET_DIRECTORY_EXT) + 1); | ||
118 | strcpy(fn, list->filename); | ||
119 | if (fn[strlen(fn)-1] == '/') | ||
120 | fn[strlen(fn)-1] = '\0'; | ||
121 | strcat(fn, GNUNET_DIRECTORY_EXT); | ||
122 | if (0 != stat(list->filename, | ||
123 | &buf)) { | ||
124 | FREE(fn); | ||
125 | return; | ||
126 | } | ||
127 | f = fn; | ||
128 | } else { | ||
129 | fn = NULL; | ||
130 | f = list->filename; | ||
131 | } | ||
132 | size = buf.st_size; | ||
133 | if (size == 0) { | ||
134 | FREENONNULL(fn); | ||
116 | return; | 135 | return; |
136 | } | ||
117 | fd = disk_file_open(ectx, | 137 | fd = disk_file_open(ectx, |
118 | list->filename, | 138 | list->filename, |
119 | O_RDONLY); | 139 | O_RDONLY); |
120 | if (fd == -1) | 140 | if (fd == -1) { |
141 | FREENONNULL(fn); | ||
121 | return; | 142 | return; |
143 | } | ||
122 | data = MMAP(NULL, | 144 | data = MMAP(NULL, |
123 | size, | 145 | size, |
124 | PROT_READ, | 146 | PROT_READ, |
@@ -130,10 +152,12 @@ refreshDirectoryViewFromDisk(DownloadList * list) { | |||
130 | GE_LOG_STRERROR_FILE(ectx, | 152 | GE_LOG_STRERROR_FILE(ectx, |
131 | GE_ERROR | GE_ADMIN | GE_BULK, | 153 | GE_ERROR | GE_ADMIN | GE_BULK, |
132 | "mmap", | 154 | "mmap", |
133 | list->filename); | 155 | f); |
134 | CLOSE(fd); | 156 | CLOSE(fd); |
157 | FREENONNULL(fn); | ||
135 | return; | 158 | return; |
136 | } | 159 | } |
160 | FREENONNULL(fn); | ||
137 | meta = NULL; | 161 | meta = NULL; |
138 | ECRS_listDirectory(ectx, | 162 | ECRS_listDirectory(ectx, |
139 | data, | 163 | data, |
@@ -613,6 +637,7 @@ initiateDownload(GtkTreeModel * model, | |||
613 | NULL)) { | 637 | NULL)) { |
614 | addLogEntry(_("Downloading `%s'"), | 638 | addLogEntry(_("Downloading `%s'"), |
615 | idc_name); | 639 | idc_name); |
640 | /* FIXME! DEADLOCK! */ | ||
616 | FSUI_startDownload(ctx, | 641 | FSUI_startDownload(ctx, |
617 | getSpinButtonValue(searchContext->searchXML, | 642 | getSpinButtonValue(searchContext->searchXML, |
618 | "downloadAnonymitySpinButton"), | 643 | "downloadAnonymitySpinButton"), |
diff --git a/src/plugins/fs/search.c b/src/plugins/fs/search.c index 8b2b5302..d8521179 100644 --- a/src/plugins/fs/search.c +++ b/src/plugins/fs/search.c | |||
@@ -636,6 +636,7 @@ void on_fssearchbutton_clicked_fs(gpointer dummy2, | |||
636 | } | 636 | } |
637 | list = list->next; | 637 | list = list->next; |
638 | } | 638 | } |
639 | /* FIXME: deadlock! */ | ||
639 | FSUI_startSearch(ctx, | 640 | FSUI_startSearch(ctx, |
640 | getSpinButtonValue(getMainXML(), | 641 | getSpinButtonValue(getMainXML(), |
641 | "searchAnonymitySelectionSpinButton"), | 642 | "searchAnonymitySelectionSpinButton"), |
@@ -696,6 +697,7 @@ void on_closeSearchButton_clicked_fs(GtkWidget * searchPage, | |||
696 | void on_abortSearchButton_clicked_fs(GtkWidget * searchPage, | 697 | void on_abortSearchButton_clicked_fs(GtkWidget * searchPage, |
697 | GtkWidget * closeButton) { | 698 | GtkWidget * closeButton) { |
698 | SearchList * list; | 699 | SearchList * list; |
700 | struct FCBC fcbc; | ||
699 | 701 | ||
700 | list = search_head; | 702 | list = search_head; |
701 | while (list != NULL) { | 703 | while (list != NULL) { |
@@ -704,8 +706,11 @@ void on_abortSearchButton_clicked_fs(GtkWidget * searchPage, | |||
704 | list = list->next; | 706 | list = list->next; |
705 | } | 707 | } |
706 | GE_ASSERT(ectx, list != NULL); | 708 | GE_ASSERT(ectx, list != NULL); |
707 | FSUI_abortSearch(ctx, | 709 | |
708 | list->fsui_list); | 710 | fcbc.method = &FSUI_abortSearch; |
711 | fcbc.argument = list->fsui_list; | ||
712 | run_with_save_calls(&fsui_callback, | ||
713 | &fcbc); | ||
709 | } | 714 | } |
710 | 715 | ||
711 | static void stopSearch(GtkTreeModel * model, | 716 | static void stopSearch(GtkTreeModel * model, |
diff --git a/src/plugins/fs/upload.c b/src/plugins/fs/upload.c index 9d3fea8d..aa800b34 100644 --- a/src/plugins/fs/upload.c +++ b/src/plugins/fs/upload.c | |||
@@ -405,6 +405,7 @@ void on_fsinsertuploadbutton_clicked_fs(gpointer dummy, | |||
405 | gkeywordURI = ECRS_stringToUri(ectx, | 405 | gkeywordURI = ECRS_stringToUri(ectx, |
406 | ECRS_URI_PREFIX | 406 | ECRS_URI_PREFIX |
407 | ECRS_SEARCH_INFIX); | 407 | ECRS_SEARCH_INFIX); |
408 | /* FIXME: DEADLOCK! */ | ||
408 | FSUI_startUpload(ctx, | 409 | FSUI_startUpload(ctx, |
409 | filename, | 410 | filename, |
410 | (DirectoryScanCallback) &disk_directory_scan, | 411 | (DirectoryScanCallback) &disk_directory_scan, |