aboutsummaryrefslogtreecommitdiff
path: root/src/fs/test_fs_list_indexed.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2009-10-26 08:42:01 +0000
committerChristian Grothoff <christian@grothoff.org>2009-10-26 08:42:01 +0000
commitc08e1f146fa54cd6d855610000fc7861c4fee678 (patch)
tree30b6b47fc03cf914cf7ba5dbfaa51fd310caa075 /src/fs/test_fs_list_indexed.c
parent5ac8527fda4c6f7fb3622c38a6b811a2f74460af (diff)
downloadgnunet-c08e1f146fa54cd6d855610000fc7861c4fee678.tar.gz
gnunet-c08e1f146fa54cd6d855610000fc7861c4fee678.zip
fixes
Diffstat (limited to 'src/fs/test_fs_list_indexed.c')
-rw-r--r--src/fs/test_fs_list_indexed.c76
1 files changed, 56 insertions, 20 deletions
diff --git a/src/fs/test_fs_list_indexed.c b/src/fs/test_fs_list_indexed.c
index 1585e2117..6044e6955 100644
--- a/src/fs/test_fs_list_indexed.c
+++ b/src/fs/test_fs_list_indexed.c
@@ -109,19 +109,26 @@ static void *
109progress_cb (void *cls, 109progress_cb (void *cls,
110 const struct GNUNET_FS_ProgressInfo *event) 110 const struct GNUNET_FS_ProgressInfo *event)
111{ 111{
112 void *ret;
112 113
114 ret = NULL;
113 switch (event->status) 115 switch (event->status)
114 { 116 {
115 case GNUNET_FS_STATUS_PUBLISH_COMPLETED: 117 case GNUNET_FS_STATUS_PUBLISH_COMPLETED:
118 ret = event->value.publish.cctx;
116 printf ("Publish complete, %llu kbps.\n", 119 printf ("Publish complete, %llu kbps.\n",
117 (unsigned long long) (FILESIZE * 1000 / (1+GNUNET_TIME_absolute_get_duration (start).value) / 1024)); 120 (unsigned long long) (FILESIZE * 1000 / (1+GNUNET_TIME_absolute_get_duration (start).value) / 1024));
118 GNUNET_SCHEDULER_add_continuation (sched, 121 if (0 == strcmp ("list_indexed-context-dir",
119 GNUNET_NO, 122 event->value.publish.cctx))
120 &list_indexed_task, 123 GNUNET_SCHEDULER_add_continuation (sched,
121 NULL, 124 GNUNET_NO,
122 GNUNET_SCHEDULER_REASON_PREREQ_DONE); 125 &list_indexed_task,
126 NULL,
127 GNUNET_SCHEDULER_REASON_PREREQ_DONE);
128
123 break; 129 break;
124 case GNUNET_FS_STATUS_PUBLISH_PROGRESS: 130 case GNUNET_FS_STATUS_PUBLISH_PROGRESS:
131 ret = event->value.publish.cctx;
125 GNUNET_assert (publish == event->value.publish.sc); 132 GNUNET_assert (publish == event->value.publish.sc);
126#if VERBOSE 133#if VERBOSE
127 printf ("Publish is progressing (%llu/%llu at level %u off %llu)...\n", 134 printf ("Publish is progressing (%llu/%llu at level %u off %llu)...\n",
@@ -132,33 +139,62 @@ progress_cb (void *cls,
132#endif 139#endif
133 break; 140 break;
134 case GNUNET_FS_STATUS_PUBLISH_ERROR: 141 case GNUNET_FS_STATUS_PUBLISH_ERROR:
142 ret = event->value.publish.cctx;
135 fprintf (stderr, 143 fprintf (stderr,
136 "Error publishing file: %s\n", 144 "Error publishing file: %s\n",
137 event->value.publish.specifics.error.message); 145 event->value.publish.specifics.error.message);
138 err = 1; 146 err = 1;
139 GNUNET_SCHEDULER_add_continuation (sched, 147 if (0 == strcmp ("list_indexed-context-dir",
140 GNUNET_NO, 148 event->value.publish.cctx))
141 &abort_publish_task, 149 GNUNET_SCHEDULER_add_continuation (sched,
142 NULL, 150 GNUNET_NO,
143 GNUNET_SCHEDULER_REASON_PREREQ_DONE); 151 &abort_publish_task,
152 NULL,
153 GNUNET_SCHEDULER_REASON_PREREQ_DONE);
144 break; 154 break;
145 case GNUNET_FS_STATUS_PUBLISH_START: 155 case GNUNET_FS_STATUS_PUBLISH_START:
146 GNUNET_assert (0 == strcmp ("publish-context", event->value.publish.cctx)); 156 ret = event->value.publish.cctx;
147 GNUNET_assert (NULL == event->value.publish.pctx); 157 if (0 == strcmp ("list_indexed-context1",
148 GNUNET_assert (FILESIZE == event->value.publish.size); 158 event->value.publish.cctx))
149 GNUNET_assert (0 == event->value.publish.completed); 159 {
150 GNUNET_assert (1 == event->value.publish.anonymity); 160 GNUNET_assert (0 == strcmp ("list_indexed-context-dir",
161 event->value.publish.pctx));
162 GNUNET_assert (FILESIZE == event->value.publish.size);
163 GNUNET_assert (0 == event->value.publish.completed);
164 GNUNET_assert (1 == event->value.publish.anonymity);
165 }
166 else if (0 == strcmp ("list_indexed-context2",
167 event->value.publish.cctx))
168 {
169 GNUNET_assert (0 == strcmp ("list_indexed-context-dir",
170 event->value.publish.pctx));
171 GNUNET_assert (FILESIZE == event->value.publish.size);
172 GNUNET_assert (0 == event->value.publish.completed);
173 GNUNET_assert (2 == event->value.publish.anonymity);
174 }
175 else if (0 == strcmp ("list_indexed-context-dir",
176 event->value.publish.cctx))
177 {
178 GNUNET_assert (0 == event->value.publish.completed);
179 GNUNET_assert (3 == event->value.publish.anonymity);
180 }
181 else
182 GNUNET_assert (0);
151 break; 183 break;
152 case GNUNET_FS_STATUS_PUBLISH_STOPPED: 184 case GNUNET_FS_STATUS_PUBLISH_STOPPED:
153 GNUNET_assert (publish == event->value.publish.sc); 185 if (0 == strcmp ("list_indexed-context-dir",
154 publish = NULL; 186 event->value.publish.cctx))
187 {
188 GNUNET_assert (publish == event->value.publish.sc);
189 publish = NULL;
190 }
155 break; 191 break;
156 default: 192 default:
157 printf ("Unexpected event: %d\n", 193 printf ("Unexpected event: %d\n",
158 event->status); 194 event->status);
159 break; 195 break;
160 } 196 }
161 return NULL; 197 return ret;
162} 198}
163 199
164 200
@@ -261,13 +297,13 @@ run (void *cls,
261 kuri, 297 kuri,
262 meta, 298 meta,
263 GNUNET_YES, 299 GNUNET_YES,
264 1, 300 2,
265 42, 301 42,
266 GNUNET_TIME_relative_to_absolute (LIFETIME)); 302 GNUNET_TIME_relative_to_absolute (LIFETIME));
267 fidir = GNUNET_FS_file_information_create_empty_directory ("list_indexed-context-dir", 303 fidir = GNUNET_FS_file_information_create_empty_directory ("list_indexed-context-dir",
268 kuri, 304 kuri,
269 meta, 305 meta,
270 1, 306 3,
271 42, 307 42,
272 GNUNET_TIME_relative_to_absolute (LIFETIME)); 308 GNUNET_TIME_relative_to_absolute (LIFETIME));
273 GNUNET_assert (GNUNET_OK == GNUNET_FS_file_information_add (fidir, fi1)); 309 GNUNET_assert (GNUNET_OK == GNUNET_FS_file_information_add (fidir, fi1));