aboutsummaryrefslogtreecommitdiff
path: root/src/fs
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2012-01-11 21:11:51 +0000
committerChristian Grothoff <christian@grothoff.org>2012-01-11 21:11:51 +0000
commit5826f9d6280175acde486a1b02c93197a49396bd (patch)
tree57bab01eff235ae52062b662220a01c9dfad6142 /src/fs
parent354a420bc1ddcc46b837a4e99e874195a53b7d57 (diff)
downloadgnunet-5826f9d6280175acde486a1b02c93197a49396bd.tar.gz
gnunet-5826f9d6280175acde486a1b02c93197a49396bd.zip
fixing bug to ensure that we properly descend into deep directories for the various publish start/stop/suspend/resume event callbacks
Diffstat (limited to 'src/fs')
-rw-r--r--src/fs/fs_api.c19
-rw-r--r--src/fs/fs_api.h7
-rw-r--r--src/fs/fs_publish.c33
3 files changed, 55 insertions, 4 deletions
diff --git a/src/fs/fs_api.c b/src/fs/fs_api.c
index 2b1e51031..3c0d5bc72 100644
--- a/src/fs/fs_api.c
+++ b/src/fs/fs_api.c
@@ -1243,13 +1243,24 @@ fip_signal_resume (void *cls, struct GNUNET_FS_FileInformation *fi,
1243 struct GNUNET_FS_BlockOptions *bo, int *do_index, 1243 struct GNUNET_FS_BlockOptions *bo, int *do_index,
1244 void **client_info) 1244 void **client_info)
1245{ 1245{
1246 struct GNUNET_FS_PublishContext *sc = cls; 1246 struct GNUNET_FS_PublishContext *pc = cls;
1247 struct GNUNET_FS_ProgressInfo pi; 1247 struct GNUNET_FS_ProgressInfo pi;
1248 1248
1249 if (GNUNET_YES == pc->skip_next_fi_callback)
1250 {
1251 pc->skip_next_fi_callback = GNUNET_NO;
1252 return GNUNET_OK;
1253 }
1249 pi.status = GNUNET_FS_STATUS_PUBLISH_RESUME; 1254 pi.status = GNUNET_FS_STATUS_PUBLISH_RESUME;
1250 pi.value.publish.specifics.resume.message = sc->fi->emsg; 1255 pi.value.publish.specifics.resume.message = pc->fi->emsg;
1251 pi.value.publish.specifics.resume.chk_uri = sc->fi->chk_uri; 1256 pi.value.publish.specifics.resume.chk_uri = pc->fi->chk_uri;
1252 *client_info = GNUNET_FS_publish_make_status_ (&pi, sc, fi, 0); 1257 *client_info = GNUNET_FS_publish_make_status_ (&pi, pc, fi, 0);
1258 if (GNUNET_YES == GNUNET_FS_meta_data_test_for_directory (meta))
1259 {
1260 /* process entries in directory */
1261 pc->skip_next_fi_callback = GNUNET_YES;
1262 GNUNET_FS_file_information_inspect (fi, &fip_signal_resume, pc);
1263 }
1253 return GNUNET_OK; 1264 return GNUNET_OK;
1254} 1265}
1255 1266
diff --git a/src/fs/fs_api.h b/src/fs/fs_api.h
index 4f3781d01..42daa7bc2 100644
--- a/src/fs/fs_api.h
+++ b/src/fs/fs_api.h
@@ -1203,6 +1203,13 @@ struct GNUNET_FS_PublishContext
1203 * Set to GNUNET_YES if all processing has completed. 1203 * Set to GNUNET_YES if all processing has completed.
1204 */ 1204 */
1205 int all_done; 1205 int all_done;
1206
1207 /**
1208 * Flag set to GNUNET_YES if the next callback from
1209 * GNUNET_FS_file_information_inspect should be skipped because it
1210 * is for the directory which was already processed with the parent.
1211 */
1212 int skip_next_fi_callback;
1206}; 1213};
1207 1214
1208 1215
diff --git a/src/fs/fs_publish.c b/src/fs/fs_publish.c
index 05f667451..4ae3264a2 100644
--- a/src/fs/fs_publish.c
+++ b/src/fs/fs_publish.c
@@ -954,6 +954,11 @@ fip_signal_start (void *cls, struct GNUNET_FS_FileInformation *fi,
954 unsigned int kc; 954 unsigned int kc;
955 uint64_t left; 955 uint64_t left;
956 956
957 if (GNUNET_YES == pc->skip_next_fi_callback)
958 {
959 pc->skip_next_fi_callback = GNUNET_NO;
960 return GNUNET_OK;
961 }
957#if DEBUG_PUBLISH 962#if DEBUG_PUBLISH
958 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Starting publish operation\n"); 963 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Starting publish operation\n");
959#endif 964#endif
@@ -991,6 +996,12 @@ fip_signal_start (void *cls, struct GNUNET_FS_FileInformation *fi,
991 pi.status = GNUNET_FS_STATUS_PUBLISH_START; 996 pi.status = GNUNET_FS_STATUS_PUBLISH_START;
992 *client_info = GNUNET_FS_publish_make_status_ (&pi, pc, fi, 0); 997 *client_info = GNUNET_FS_publish_make_status_ (&pi, pc, fi, 0);
993 GNUNET_FS_file_information_sync_ (fi); 998 GNUNET_FS_file_information_sync_ (fi);
999 if (GNUNET_YES == GNUNET_FS_meta_data_test_for_directory (meta))
1000 {
1001 /* process entries in directory */
1002 pc->skip_next_fi_callback = GNUNET_YES;
1003 GNUNET_FS_file_information_inspect (fi, &fip_signal_start, pc);
1004 }
994 return GNUNET_OK; 1005 return GNUNET_OK;
995} 1006}
996 1007
@@ -1020,6 +1031,17 @@ fip_signal_suspend (void *cls, struct GNUNET_FS_FileInformation *fi,
1020 struct GNUNET_FS_ProgressInfo pi; 1031 struct GNUNET_FS_ProgressInfo pi;
1021 uint64_t off; 1032 uint64_t off;
1022 1033
1034 if (GNUNET_YES == pc->skip_next_fi_callback)
1035 {
1036 pc->skip_next_fi_callback = GNUNET_NO;
1037 return GNUNET_OK;
1038 }
1039 if (GNUNET_YES == GNUNET_FS_meta_data_test_for_directory (meta))
1040 {
1041 /* process entries in directory */
1042 pc->skip_next_fi_callback = GNUNET_YES;
1043 GNUNET_FS_file_information_inspect (fi, &fip_signal_suspend, pc);
1044 }
1023#if DEBUG_PUBLISH 1045#if DEBUG_PUBLISH
1024 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Suspending publish operation\n"); 1046 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Suspending publish operation\n");
1025#endif 1047#endif
@@ -1204,6 +1226,17 @@ fip_signal_stop (void *cls, struct GNUNET_FS_FileInformation *fi,
1204 struct GNUNET_FS_ProgressInfo pi; 1226 struct GNUNET_FS_ProgressInfo pi;
1205 uint64_t off; 1227 uint64_t off;
1206 1228
1229 if (GNUNET_YES == pc->skip_next_fi_callback)
1230 {
1231 pc->skip_next_fi_callback = GNUNET_NO;
1232 return GNUNET_OK;
1233 }
1234 if (GNUNET_YES == GNUNET_FS_meta_data_test_for_directory (meta))
1235 {
1236 /* process entries in directory first */
1237 pc->skip_next_fi_callback = GNUNET_YES;
1238 GNUNET_FS_file_information_inspect (fi, &fip_signal_stop, pc);
1239 }
1207 if (fi->serialization != NULL) 1240 if (fi->serialization != NULL)
1208 { 1241 {
1209 GNUNET_FS_remove_sync_file_ (pc->h, GNUNET_FS_SYNC_PATH_FILE_INFO, 1242 GNUNET_FS_remove_sync_file_ (pc->h, GNUNET_FS_SYNC_PATH_FILE_INFO,