summaryrefslogtreecommitdiff
path: root/src/fs/gnunet-service-fs_push.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/fs/gnunet-service-fs_push.c')
-rw-r--r--src/fs/gnunet-service-fs_push.c468
1 files changed, 233 insertions, 235 deletions
diff --git a/src/fs/gnunet-service-fs_push.c b/src/fs/gnunet-service-fs_push.c
index a75f17f82..162dcc0b5 100644
--- a/src/fs/gnunet-service-fs_push.c
+++ b/src/fs/gnunet-service-fs_push.c
@@ -11,12 +11,12 @@
11 WITHOUT ANY WARRANTY; without even the implied warranty of 11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details. 13 Affero General Public License for more details.
14 14
15 You should have received a copy of the GNU Affero General Public License 15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>. 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 17
18 SPDX-License-Identifier: AGPL3.0-or-later 18 SPDX-License-Identifier: AGPL3.0-or-later
19*/ 19 */
20 20
21/** 21/**
22 * @file fs/gnunet-service-fs_push.c 22 * @file fs/gnunet-service-fs_push.c
@@ -49,15 +49,13 @@
49 * that if this value is increased, the migration testcase may need to be 49 * that if this value is increased, the migration testcase may need to be
50 * adjusted as well (especially the CONTENT_LIFETIME in fs_test_lib.c). 50 * adjusted as well (especially the CONTENT_LIFETIME in fs_test_lib.c).
51 */ 51 */
52#define MIN_MIGRATION_CONTENT_LIFETIME GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 30) 52#define MIN_MIGRATION_CONTENT_LIFETIME GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_MINUTES, 30)
53 53
54 54
55/** 55/**
56 * Block that is ready for migration to other peers. Actual data is at the end of the block. 56 * Block that is ready for migration to other peers. Actual data is at the end of the block.
57 */ 57 */
58struct MigrationReadyBlock 58struct MigrationReadyBlock {
59{
60
61 /** 59 /**
62 * This is a doubly-linked list. 60 * This is a doubly-linked list.
63 */ 61 */
@@ -104,8 +102,7 @@ struct MigrationReadyBlock
104/** 102/**
105 * Information about a peer waiting for migratable data. 103 * Information about a peer waiting for migratable data.
106 */ 104 */
107struct MigrationReadyPeer 105struct MigrationReadyPeer {
108{
109 /** 106 /**
110 * This is a doubly-linked list. 107 * This is a doubly-linked list.
111 */ 108 */
@@ -186,15 +183,15 @@ static int value_found;
186 * @param mb block to delete 183 * @param mb block to delete
187 */ 184 */
188static void 185static void
189delete_migration_block (struct MigrationReadyBlock *mb) 186delete_migration_block(struct MigrationReadyBlock *mb)
190{ 187{
191 GNUNET_CONTAINER_DLL_remove (mig_head, 188 GNUNET_CONTAINER_DLL_remove(mig_head,
192 mig_tail, 189 mig_tail,
193 mb); 190 mb);
194 GNUNET_PEER_decrement_rcs (mb->target_list, 191 GNUNET_PEER_decrement_rcs(mb->target_list,
195 MIGRATION_LIST_SIZE); 192 MIGRATION_LIST_SIZE);
196 mig_size--; 193 mig_size--;
197 GNUNET_free (mb); 194 GNUNET_free(mb);
198} 195}
199 196
200 197
@@ -204,7 +201,7 @@ delete_migration_block (struct MigrationReadyBlock *mb)
204 * @param cls a `struct MigrationReadyPeer *` 201 * @param cls a `struct MigrationReadyPeer *`
205 */ 202 */
206static void 203static void
207find_content (void *cls); 204find_content(void *cls);
208 205
209 206
210/** 207/**
@@ -215,50 +212,50 @@ find_content (void *cls);
215 * @return #GNUNET_YES if the block was deleted (!) 212 * @return #GNUNET_YES if the block was deleted (!)
216 */ 213 */
217static int 214static int
218transmit_content (struct MigrationReadyPeer *mrp, 215transmit_content(struct MigrationReadyPeer *mrp,
219 struct MigrationReadyBlock *block) 216 struct MigrationReadyBlock *block)
220{ 217{
221 struct PutMessage *msg; 218 struct PutMessage *msg;
222 unsigned int i; 219 unsigned int i;
223 struct GSF_PeerPerformanceData *ppd; 220 struct GSF_PeerPerformanceData *ppd;
224 int ret; 221 int ret;
225 222
226 ppd = GSF_get_peer_performance_data_ (mrp->peer); 223 ppd = GSF_get_peer_performance_data_(mrp->peer);
227 GNUNET_assert (NULL == mrp->env); 224 GNUNET_assert(NULL == mrp->env);
228 mrp->env = GNUNET_MQ_msg_extra (msg, 225 mrp->env = GNUNET_MQ_msg_extra(msg,
229 block->size, 226 block->size,
230 GNUNET_MESSAGE_TYPE_FS_PUT); 227 GNUNET_MESSAGE_TYPE_FS_PUT);
231 msg->type = htonl (block->type); 228 msg->type = htonl(block->type);
232 msg->expiration = GNUNET_TIME_absolute_hton (block->expiration); 229 msg->expiration = GNUNET_TIME_absolute_hton(block->expiration);
233 GNUNET_memcpy (&msg[1], 230 GNUNET_memcpy(&msg[1],
234 &block[1], 231 &block[1],
235 block->size); 232 block->size);
236 for (i = 0; i < MIGRATION_LIST_SIZE; i++) 233 for (i = 0; i < MIGRATION_LIST_SIZE; i++)
237 {
238 if (block->target_list[i] == 0)
239 { 234 {
240 block->target_list[i] = ppd->pid; 235 if (block->target_list[i] == 0)
241 GNUNET_PEER_change_rc (block->target_list[i], 236 {
242 1); 237 block->target_list[i] = ppd->pid;
243 break; 238 GNUNET_PEER_change_rc(block->target_list[i],
239 1);
240 break;
241 }
244 } 242 }
245 }
246 if (MIGRATION_LIST_SIZE == i) 243 if (MIGRATION_LIST_SIZE == i)
247 { 244 {
248 delete_migration_block (block); 245 delete_migration_block(block);
249 ret = GNUNET_YES; 246 ret = GNUNET_YES;
250 } 247 }
251 else 248 else
252 { 249 {
253 ret = GNUNET_NO; 250 ret = GNUNET_NO;
254 } 251 }
255 GNUNET_MQ_notify_sent (mrp->env, 252 GNUNET_MQ_notify_sent(mrp->env,
256 &find_content, 253 &find_content,
257 mrp); 254 mrp);
258 GSF_peer_transmit_ (mrp->peer, 255 GSF_peer_transmit_(mrp->peer,
259 GNUNET_NO, 256 GNUNET_NO,
260 0 /* priority */ , 257 0 /* priority */,
261 mrp->env); 258 mrp->env);
262 return ret; 259 return ret;
263} 260}
264 261
@@ -271,7 +268,7 @@ transmit_content (struct MigrationReadyPeer *mrp,
271 * @return number of times block was forwarded 268 * @return number of times block was forwarded
272 */ 269 */
273static unsigned int 270static unsigned int
274count_targets (struct MigrationReadyBlock *block) 271count_targets(struct MigrationReadyBlock *block)
275{ 272{
276 unsigned int i; 273 unsigned int i;
277 274
@@ -291,8 +288,8 @@ count_targets (struct MigrationReadyBlock *block)
291 * @return score (>= 0: feasible, negative: infeasible) 288 * @return score (>= 0: feasible, negative: infeasible)
292 */ 289 */
293static long 290static long
294score_content (struct MigrationReadyPeer *mrp, 291score_content(struct MigrationReadyPeer *mrp,
295 struct MigrationReadyBlock *block) 292 struct MigrationReadyBlock *block)
296{ 293{
297 unsigned int i; 294 unsigned int i;
298 struct GSF_PeerPerformanceData *ppd; 295 struct GSF_PeerPerformanceData *ppd;
@@ -300,18 +297,18 @@ score_content (struct MigrationReadyPeer *mrp,
300 struct GNUNET_HashCode hc; 297 struct GNUNET_HashCode hc;
301 uint32_t dist; 298 uint32_t dist;
302 299
303 ppd = GSF_get_peer_performance_data_ (mrp->peer); 300 ppd = GSF_get_peer_performance_data_(mrp->peer);
304 for (i = 0; i < MIGRATION_LIST_SIZE; i++) 301 for (i = 0; i < MIGRATION_LIST_SIZE; i++)
305 if (block->target_list[i] == ppd->pid) 302 if (block->target_list[i] == ppd->pid)
306 return -1; 303 return -1;
307 GNUNET_assert (0 != ppd->pid); 304 GNUNET_assert(0 != ppd->pid);
308 GNUNET_PEER_resolve (ppd->pid, 305 GNUNET_PEER_resolve(ppd->pid,
309 &id); 306 &id);
310 GNUNET_CRYPTO_hash (&id, 307 GNUNET_CRYPTO_hash(&id,
311 sizeof (struct GNUNET_PeerIdentity), 308 sizeof(struct GNUNET_PeerIdentity),
312 &hc); 309 &hc);
313 dist = GNUNET_CRYPTO_hash_distance_u32 (&block->query, 310 dist = GNUNET_CRYPTO_hash_distance_u32(&block->query,
314 &hc); 311 &hc);
315 /* closer distance, higher score: */ 312 /* closer distance, higher score: */
316 return UINT32_MAX - dist; 313 return UINT32_MAX - dist;
317} 314}
@@ -322,7 +319,7 @@ score_content (struct MigrationReadyPeer *mrp,
322 * (re)scheduling it with the appropriate delay. 319 * (re)scheduling it with the appropriate delay.
323 */ 320 */
324static void 321static void
325consider_gathering (void); 322consider_gathering(void);
326 323
327 324
328/** 325/**
@@ -331,7 +328,7 @@ consider_gathering (void);
331 * @param cls peer to find content for 328 * @param cls peer to find content for
332 */ 329 */
333static void 330static void
334find_content (void *cls) 331find_content(void *cls)
335{ 332{
336 struct MigrationReadyPeer *mrp = cls; 333 struct MigrationReadyPeer *mrp = cls;
337 struct MigrationReadyBlock *pos; 334 struct MigrationReadyBlock *pos;
@@ -344,48 +341,48 @@ find_content (void *cls)
344 best_score = -1; 341 best_score = -1;
345 pos = mig_head; 342 pos = mig_head;
346 while (NULL != pos) 343 while (NULL != pos)
347 {
348 score = score_content (mrp, pos);
349 if (score > best_score)
350 { 344 {
351 best_score = score; 345 score = score_content(mrp, pos);
352 best = pos; 346 if (score > best_score)
347 {
348 best_score = score;
349 best = pos;
350 }
351 pos = pos->next;
353 } 352 }
354 pos = pos->next;
355 }
356 if (NULL == best) 353 if (NULL == best)
357 {
358 if (mig_size < MAX_MIGRATION_QUEUE)
359 { 354 {
360 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 355 if (mig_size < MAX_MIGRATION_QUEUE)
361 "No content found for pushing, waiting for queue to fill\n"); 356 {
362 return; /* will fill up eventually... */ 357 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
363 } 358 "No content found for pushing, waiting for queue to fill\n");
364 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 359 return; /* will fill up eventually... */
365 "No suitable content found, purging content from full queue\n"); 360 }
366 /* failed to find migration target AND 361 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
367 * queue is full, purge most-forwarded 362 "No suitable content found, purging content from full queue\n");
368 * block from queue to make room for more */ 363 /* failed to find migration target AND
369 pos = mig_head; 364 * queue is full, purge most-forwarded
370 while (NULL != pos) 365 * block from queue to make room for more */
371 { 366 pos = mig_head;
372 score = count_targets (pos); 367 while (NULL != pos)
373 if (score >= best_score) 368 {
374 { 369 score = count_targets(pos);
375 best_score = score; 370 if (score >= best_score)
376 best = pos; 371 {
377 } 372 best_score = score;
378 pos = pos->next; 373 best = pos;
374 }
375 pos = pos->next;
376 }
377 GNUNET_assert(NULL != best);
378 delete_migration_block(best);
379 consider_gathering();
380 return;
379 } 381 }
380 GNUNET_assert (NULL != best); 382 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
381 delete_migration_block (best); 383 "Preparing to push best content to peer\n");
382 consider_gathering (); 384 transmit_content(mrp,
383 return; 385 best);
384 }
385 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
386 "Preparing to push best content to peer\n");
387 transmit_content (mrp,
388 best);
389} 386}
390 387
391 388
@@ -396,7 +393,7 @@ find_content (void *cls)
396 * @param cls unused 393 * @param cls unused
397 */ 394 */
398static void 395static void
399gather_migration_blocks (void *cls); 396gather_migration_blocks(void *cls);
400 397
401 398
402/** 399/**
@@ -404,7 +401,7 @@ gather_migration_blocks (void *cls);
404 * (re)scheduling it with the appropriate delay. 401 * (re)scheduling it with the appropriate delay.
405 */ 402 */
406static void 403static void
407consider_gathering () 404consider_gathering()
408{ 405{
409 struct GNUNET_TIME_Relative delay; 406 struct GNUNET_TIME_Relative delay;
410 407
@@ -416,25 +413,25 @@ consider_gathering ()
416 return; 413 return;
417 if (mig_size >= MAX_MIGRATION_QUEUE) 414 if (mig_size >= MAX_MIGRATION_QUEUE)
418 return; 415 return;
419 delay = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 416 delay = GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS,
420 mig_size); 417 mig_size);
421 delay = GNUNET_TIME_relative_divide (delay, 418 delay = GNUNET_TIME_relative_divide(delay,
422 MAX_MIGRATION_QUEUE); 419 MAX_MIGRATION_QUEUE);
423 delay = GNUNET_TIME_relative_max (delay, 420 delay = GNUNET_TIME_relative_max(delay,
424 min_migration_delay); 421 min_migration_delay);
425 if (GNUNET_NO == value_found) 422 if (GNUNET_NO == value_found)
426 { 423 {
427 /* wait at least 5s if the datastore is empty */ 424 /* wait at least 5s if the datastore is empty */
428 delay = GNUNET_TIME_relative_max (delay, 425 delay = GNUNET_TIME_relative_max(delay,
429 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 426 GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS,
430 5)); 427 5));
431 } 428 }
432 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 429 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
433 "Scheduling gathering task (queue size: %u)\n", 430 "Scheduling gathering task (queue size: %u)\n",
434 mig_size); 431 mig_size);
435 mig_task = GNUNET_SCHEDULER_add_delayed (delay, 432 mig_task = GNUNET_SCHEDULER_add_delayed(delay,
436 &gather_migration_blocks, 433 &gather_migration_blocks,
437 NULL); 434 NULL);
438} 435}
439 436
440 437
@@ -454,81 +451,82 @@ consider_gathering ()
454 * maybe 0 if no unique identifier is available 451 * maybe 0 if no unique identifier is available
455 */ 452 */
456static void 453static void
457process_migration_content (void *cls, 454process_migration_content(void *cls,
458 const struct GNUNET_HashCode *key, 455 const struct GNUNET_HashCode *key,
459 size_t size, 456 size_t size,
460 const void *data, 457 const void *data,
461 enum GNUNET_BLOCK_Type type, 458 enum GNUNET_BLOCK_Type type,
462 uint32_t priority, 459 uint32_t priority,
463 uint32_t anonymity, 460 uint32_t anonymity,
464 uint32_t replication, 461 uint32_t replication,
465 struct GNUNET_TIME_Absolute expiration, 462 struct GNUNET_TIME_Absolute expiration,
466 uint64_t uid) 463 uint64_t uid)
467{ 464{
468 struct MigrationReadyBlock *mb; 465 struct MigrationReadyBlock *mb;
469 struct MigrationReadyPeer *pos; 466 struct MigrationReadyPeer *pos;
470 467
471 mig_qe = NULL; 468 mig_qe = NULL;
472 if (NULL == key) 469 if (NULL == key)
473 { 470 {
474 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 471 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
475 "No content found for migration...\n"); 472 "No content found for migration...\n");
476 consider_gathering (); 473 consider_gathering();
477 return; 474 return;
478 } 475 }
479 value_found = GNUNET_YES; 476 value_found = GNUNET_YES;
480 if (GNUNET_TIME_absolute_get_remaining (expiration).rel_value_us < 477 if (GNUNET_TIME_absolute_get_remaining(expiration).rel_value_us <
481 MIN_MIGRATION_CONTENT_LIFETIME.rel_value_us) 478 MIN_MIGRATION_CONTENT_LIFETIME.rel_value_us)
482 { 479 {
483 /* content will expire soon, don't bother */ 480 /* content will expire soon, don't bother */
484 consider_gathering (); 481 consider_gathering();
485 return; 482 return;
486 } 483 }
487 if (type == GNUNET_BLOCK_TYPE_FS_ONDEMAND) 484 if (type == GNUNET_BLOCK_TYPE_FS_ONDEMAND)
488 { 485 {
489 if (GNUNET_OK != 486 if (GNUNET_OK !=
490 GNUNET_FS_handle_on_demand_block (key, 487 GNUNET_FS_handle_on_demand_block(key,
491 size, 488 size,
492 data, 489 data,
493 type, 490 type,
494 priority, 491 priority,
495 anonymity, 492 anonymity,
496 replication, 493 replication,
497 expiration, 494 expiration,
498 uid, 495 uid,
499 &process_migration_content, 496 &process_migration_content,
500 NULL)) 497 NULL))
501 consider_gathering (); 498 consider_gathering();
502 return; 499 return;
503 } 500 }
504 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 501 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
505 "Retrieved block `%s' of type %u for migration (queue size: %u/%u)\n", 502 "Retrieved block `%s' of type %u for migration (queue size: %u/%u)\n",
506 GNUNET_h2s (key), 503 GNUNET_h2s(key),
507 type, mig_size + 1, 504 type, mig_size + 1,
508 MAX_MIGRATION_QUEUE); 505 MAX_MIGRATION_QUEUE);
509 mb = GNUNET_malloc (sizeof (struct MigrationReadyBlock) + size); 506 mb = GNUNET_malloc(sizeof(struct MigrationReadyBlock) + size);
510 mb->query = *key; 507 mb->query = *key;
511 mb->expiration = expiration; 508 mb->expiration = expiration;
512 mb->size = size; 509 mb->size = size;
513 mb->type = type; 510 mb->type = type;
514 GNUNET_memcpy (&mb[1], data, size); 511 GNUNET_memcpy(&mb[1], data, size);
515 GNUNET_CONTAINER_DLL_insert_after (mig_head, 512 GNUNET_CONTAINER_DLL_insert_after(mig_head,
516 mig_tail, 513 mig_tail,
517 mig_tail, 514 mig_tail,
518 mb); 515 mb);
519 mig_size++; 516 mig_size++;
520 for (pos = peer_head; NULL != pos; pos = pos->next) 517 for (pos = peer_head; NULL != pos; pos = pos->next)
521 { 518 {
522 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 519 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
523 "Preparing to push best content to peer %s\n", 520 "Preparing to push best content to peer %s\n",
524 GNUNET_i2s (GSF_connected_peer_get_identity2_(pos->peer))); 521 GNUNET_i2s(GSF_connected_peer_get_identity2_(pos->peer)));
525 if ( (NULL == pos->env) && 522 if ((NULL == pos->env) &&
526 (GNUNET_YES == transmit_content (pos, 523 (GNUNET_YES == transmit_content(pos,
527 mb)) ) { 524 mb)))
528 break; /* 'mb' was freed! */ 525 {
526 break; /* 'mb' was freed! */
527 }
529 } 528 }
530 } 529 consider_gathering();
531 consider_gathering ();
532} 530}
533 531
534 532
@@ -539,24 +537,24 @@ process_migration_content (void *cls,
539 * @param cls unused 537 * @param cls unused
540 */ 538 */
541static void 539static void
542gather_migration_blocks (void *cls) 540gather_migration_blocks(void *cls)
543{ 541{
544 mig_task = NULL; 542 mig_task = NULL;
545 if (mig_size >= MAX_MIGRATION_QUEUE) 543 if (mig_size >= MAX_MIGRATION_QUEUE)
546 return; 544 return;
547 if (NULL == GSF_dsh) 545 if (NULL == GSF_dsh)
548 return; 546 return;
549 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 547 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
550 "Asking datastore for content for replication (queue size: %u)\n", 548 "Asking datastore for content for replication (queue size: %u)\n",
551 mig_size); 549 mig_size);
552 value_found = GNUNET_NO; 550 value_found = GNUNET_NO;
553 mig_qe = GNUNET_DATASTORE_get_for_replication (GSF_dsh, 551 mig_qe = GNUNET_DATASTORE_get_for_replication(GSF_dsh,
554 0, 552 0,
555 UINT_MAX, 553 UINT_MAX,
556 &process_migration_content, 554 &process_migration_content,
557 NULL); 555 NULL);
558 if (NULL == mig_qe) 556 if (NULL == mig_qe)
559 consider_gathering (); 557 consider_gathering();
560} 558}
561 559
562 560
@@ -567,7 +565,7 @@ gather_migration_blocks (void *cls)
567 * @param peer handle for the peer that connected 565 * @param peer handle for the peer that connected
568 */ 566 */
569void 567void
570GSF_push_start_ (struct GSF_ConnectedPeer *peer) 568GSF_push_start_(struct GSF_ConnectedPeer *peer)
571{ 569{
572 struct MigrationReadyPeer *mrp; 570 struct MigrationReadyPeer *mrp;
573 571
@@ -577,22 +575,22 @@ GSF_push_start_ (struct GSF_ConnectedPeer *peer)
577 if (mrp->peer == peer) 575 if (mrp->peer == peer)
578 break; 576 break;
579 if (NULL != mrp) 577 if (NULL != mrp)
580 { 578 {
581 /* same peer added twice, must not happen */ 579 /* same peer added twice, must not happen */
582 GNUNET_break (0); 580 GNUNET_break(0);
583 return; 581 return;
584 } 582 }
585 583
586 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 584 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
587 "Adding peer %s to list for pushing\n", 585 "Adding peer %s to list for pushing\n",
588 GNUNET_i2s (GSF_connected_peer_get_identity2_(peer))); 586 GNUNET_i2s(GSF_connected_peer_get_identity2_(peer)));
589 587
590 mrp = GNUNET_new (struct MigrationReadyPeer); 588 mrp = GNUNET_new(struct MigrationReadyPeer);
591 mrp->peer = peer; 589 mrp->peer = peer;
592 find_content (mrp); 590 find_content(mrp);
593 GNUNET_CONTAINER_DLL_insert (peer_head, 591 GNUNET_CONTAINER_DLL_insert(peer_head,
594 peer_tail, 592 peer_tail,
595 mrp); 593 mrp);
596} 594}
597 595
598 596
@@ -603,7 +601,7 @@ GSF_push_start_ (struct GSF_ConnectedPeer *peer)
603 * @param peer handle for the peer that disconnected 601 * @param peer handle for the peer that disconnected
604 */ 602 */
605void 603void
606GSF_push_stop_ (struct GSF_ConnectedPeer *peer) 604GSF_push_stop_(struct GSF_ConnectedPeer *peer)
607{ 605{
608 struct MigrationReadyPeer *pos; 606 struct MigrationReadyPeer *pos;
609 607
@@ -613,11 +611,11 @@ GSF_push_stop_ (struct GSF_ConnectedPeer *peer)
613 if (NULL == pos) 611 if (NULL == pos)
614 return; 612 return;
615 if (NULL != pos->env) 613 if (NULL != pos->env)
616 GNUNET_MQ_send_cancel (pos->env); 614 GNUNET_MQ_send_cancel(pos->env);
617 GNUNET_CONTAINER_DLL_remove (peer_head, 615 GNUNET_CONTAINER_DLL_remove(peer_head,
618 peer_tail, 616 peer_tail,
619 pos); 617 pos);
620 GNUNET_free (pos); 618 GNUNET_free(pos);
621} 619}
622 620
623 621
@@ -625,28 +623,28 @@ GSF_push_stop_ (struct GSF_ConnectedPeer *peer)
625 * Setup the module. 623 * Setup the module.
626 */ 624 */
627void 625void
628GSF_push_init_ () 626GSF_push_init_()
629{ 627{
630 enabled = 628 enabled =
631 GNUNET_CONFIGURATION_get_value_yesno (GSF_cfg, 629 GNUNET_CONFIGURATION_get_value_yesno(GSF_cfg,
632 "FS", 630 "FS",
633 "CONTENT_PUSHING"); 631 "CONTENT_PUSHING");
634 if (GNUNET_YES != enabled) 632 if (GNUNET_YES != enabled)
635 return; 633 return;
636 634
637 if (GNUNET_OK != 635 if (GNUNET_OK !=
638 GNUNET_CONFIGURATION_get_value_time (GSF_cfg, 636 GNUNET_CONFIGURATION_get_value_time(GSF_cfg,
639 "fs", 637 "fs",
640 "MIN_MIGRATION_DELAY", 638 "MIN_MIGRATION_DELAY",
641 &min_migration_delay)) 639 &min_migration_delay))
642 { 640 {
643 GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_WARNING, 641 GNUNET_log_config_invalid(GNUNET_ERROR_TYPE_WARNING,
644 "fs", 642 "fs",
645 "MIN_MIGRATION_DELAY", 643 "MIN_MIGRATION_DELAY",
646 _("time required, content pushing disabled")); 644 _("time required, content pushing disabled"));
647 return; 645 return;
648 } 646 }
649 consider_gathering (); 647 consider_gathering();
650} 648}
651 649
652 650
@@ -654,21 +652,21 @@ GSF_push_init_ ()
654 * Shutdown the module. 652 * Shutdown the module.
655 */ 653 */
656void 654void
657GSF_push_done_ () 655GSF_push_done_()
658{ 656{
659 if (NULL != mig_task) 657 if (NULL != mig_task)
660 { 658 {
661 GNUNET_SCHEDULER_cancel (mig_task); 659 GNUNET_SCHEDULER_cancel(mig_task);
662 mig_task = NULL; 660 mig_task = NULL;
663 } 661 }
664 if (NULL != mig_qe) 662 if (NULL != mig_qe)
665 { 663 {
666 GNUNET_DATASTORE_cancel (mig_qe); 664 GNUNET_DATASTORE_cancel(mig_qe);
667 mig_qe = NULL; 665 mig_qe = NULL;
668 } 666 }
669 while (NULL != mig_head) 667 while (NULL != mig_head)
670 delete_migration_block (mig_head); 668 delete_migration_block(mig_head);
671 GNUNET_assert (0 == mig_size); 669 GNUNET_assert(0 == mig_size);
672} 670}
673 671
674/* end of gnunet-service-fs_push.c */ 672/* end of gnunet-service-fs_push.c */