aboutsummaryrefslogtreecommitdiff
path: root/src/topology/gnunet-daemon-topology.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2016-07-31 15:42:37 +0000
committerChristian Grothoff <christian@grothoff.org>2016-07-31 15:42:37 +0000
commit406c7d2d2d126c994a1fff13470b1f96439c6f9d (patch)
treedc5e7c62a706d03cee32734a19e183b9eddf88e2 /src/topology/gnunet-daemon-topology.c
parent8b2a3260e6aafc2ad31c8b7bff5f7d25b57bfc14 (diff)
downloadgnunet-406c7d2d2d126c994a1fff13470b1f96439c6f9d.tar.gz
gnunet-406c7d2d2d126c994a1fff13470b1f96439c6f9d.zip
convering more services to new core MQ API
Diffstat (limited to 'src/topology/gnunet-daemon-topology.c')
-rw-r--r--src/topology/gnunet-daemon-topology.c300
1 files changed, 127 insertions, 173 deletions
diff --git a/src/topology/gnunet-daemon-topology.c b/src/topology/gnunet-daemon-topology.c
index e623ae46c..f56cd4bc8 100644
--- a/src/topology/gnunet-daemon-topology.c
+++ b/src/topology/gnunet-daemon-topology.c
@@ -1,6 +1,6 @@
1/* 1/*
2 This file is part of GNUnet. 2 This file is part of GNUnet.
3 Copyright (C) 2007-2015 GNUnet e.V. 3 Copyright (C) 2007-2016 GNUnet e.V.
4 4
5 GNUnet is free software; you can redistribute it and/or modify 5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published 6 it under the terms of the GNU General Public License as published
@@ -70,10 +70,10 @@ struct Peer
70 struct GNUNET_PeerIdentity pid; 70 struct GNUNET_PeerIdentity pid;
71 71
72 /** 72 /**
73 * Our handle for the request to transmit HELLOs to this peer; NULL 73 * Our handle for transmitting to this peer; NULL
74 * if no such request is pending. 74 * if peer is not connected.
75 */ 75 */
76 struct GNUNET_CORE_TransmitHandle *hello_req; 76 struct GNUNET_MQ_Handle *mq;
77 77
78 /** 78 /**
79 * Pointer to the HELLO message of this peer; can be NULL. 79 * Pointer to the HELLO message of this peer; can be NULL.
@@ -117,11 +117,6 @@ struct Peer
117 */ 117 */
118 int is_friend; 118 int is_friend;
119 119
120 /**
121 * Are we connected to this peer right now?
122 */
123 int is_connected;
124
125}; 120};
126 121
127 122
@@ -264,16 +259,11 @@ free_peer (void *cls,
264{ 259{
265 struct Peer *pos = value; 260 struct Peer *pos = value;
266 261
267 GNUNET_break (GNUNET_NO == pos->is_connected); 262 GNUNET_break (NULL == pos->mq);
268 GNUNET_break (GNUNET_OK == 263 GNUNET_break (GNUNET_OK ==
269 GNUNET_CONTAINER_multipeermap_remove (peers, 264 GNUNET_CONTAINER_multipeermap_remove (peers,
270 pid, 265 pid,
271 pos)); 266 pos));
272 if (NULL != pos->hello_req)
273 {
274 GNUNET_CORE_notify_transmit_ready_cancel (pos->hello_req);
275 pos->hello_req = NULL;
276 }
277 if (NULL != pos->hello_delay_task) 267 if (NULL != pos->hello_delay_task)
278 { 268 {
279 GNUNET_SCHEDULER_cancel (pos->hello_delay_task); 269 GNUNET_SCHEDULER_cancel (pos->hello_delay_task);
@@ -329,7 +319,7 @@ attempt_connect (struct Peer *pos)
329 } 319 }
330 if (pos->is_friend) 320 if (pos->is_friend)
331 strength *= 2; /* friends always count more */ 321 strength *= 2; /* friends always count more */
332 if (pos->is_connected) 322 if (NULL != pos->mq)
333 strength *= 2; /* existing connections preferred */ 323 strength *= 2; /* existing connections preferred */
334 if (strength == pos->strength) 324 if (strength == pos->strength)
335 return; /* nothing to do */ 325 return; /* nothing to do */
@@ -378,8 +368,8 @@ make_peer (const struct GNUNET_PeerIdentity *peer,
378 { 368 {
379 ret->hello = GNUNET_malloc (GNUNET_HELLO_size (hello)); 369 ret->hello = GNUNET_malloc (GNUNET_HELLO_size (hello));
380 GNUNET_memcpy (ret->hello, 370 GNUNET_memcpy (ret->hello,
381 hello, 371 hello,
382 GNUNET_HELLO_size (hello)); 372 GNUNET_HELLO_size (hello));
383 } 373 }
384 GNUNET_break (GNUNET_OK == 374 GNUNET_break (GNUNET_OK ==
385 GNUNET_CONTAINER_multipeermap_put (peers, 375 GNUNET_CONTAINER_multipeermap_put (peers,
@@ -420,20 +410,6 @@ setup_filter (struct Peer *peer)
420 410
421 411
422/** 412/**
423 * Function to fill send buffer with HELLO.
424 *
425 * @param cls `struct Peer` of the target peer
426 * @param size number of bytes available in @a buf
427 * @param buf where the callee should write the message
428 * @return number of bytes written to @a buf
429 */
430static size_t
431hello_advertising_ready (void *cls,
432 size_t size,
433 void *buf);
434
435
436/**
437 * Closure for #find_advertisable_hello(). 413 * Closure for #find_advertisable_hello().
438 */ 414 */
439struct FindAdvHelloContext 415struct FindAdvHelloContext
@@ -492,7 +468,8 @@ find_advertisable_hello (void *cls,
492 hs = GNUNET_HELLO_size (pos->hello); 468 hs = GNUNET_HELLO_size (pos->hello);
493 if (hs > fah->max_size) 469 if (hs > fah->max_size)
494 return GNUNET_YES; 470 return GNUNET_YES;
495 GNUNET_CRYPTO_hash (&fah->peer->pid, sizeof (struct GNUNET_PeerIdentity), &hc); 471 GNUNET_CRYPTO_hash (&fah->peer->pid,
472 sizeof (struct GNUNET_PeerIdentity), &hc);
496 if (GNUNET_NO == 473 if (GNUNET_NO ==
497 GNUNET_CONTAINER_bloomfilter_test (pos->filter, 474 GNUNET_CONTAINER_bloomfilter_test (pos->filter,
498 &hc)) 475 &hc))
@@ -512,13 +489,13 @@ schedule_next_hello (void *cls)
512{ 489{
513 struct Peer *pl = cls; 490 struct Peer *pl = cls;
514 struct FindAdvHelloContext fah; 491 struct FindAdvHelloContext fah;
515 size_t next_want; 492 struct GNUNET_MQ_Envelope *env;
493 size_t want;
516 struct GNUNET_TIME_Relative delay; 494 struct GNUNET_TIME_Relative delay;
495 struct GNUNET_HashCode hc;
517 496
518 pl->hello_delay_task = NULL; 497 pl->hello_delay_task = NULL;
519 GNUNET_assert (GNUNET_YES == pl->is_connected); 498 GNUNET_assert (NULL != pl->mq);
520 if (pl->hello_req != NULL)
521 return; /* did not finish sending the previous one */
522 /* find applicable HELLOs */ 499 /* find applicable HELLOs */
523 fah.peer = pl; 500 fah.peer = pl;
524 fah.result = NULL; 501 fah.result = NULL;
@@ -533,18 +510,37 @@ schedule_next_hello (void *cls)
533 pl); 510 pl);
534 if (NULL == fah.result) 511 if (NULL == fah.result)
535 return; 512 return;
536 next_want = GNUNET_HELLO_size (fah.result->hello);
537 delay = GNUNET_TIME_absolute_get_remaining (pl->next_hello_allowed); 513 delay = GNUNET_TIME_absolute_get_remaining (pl->next_hello_allowed);
538 if (0 == delay.rel_value_us) 514 if (0 != delay.rel_value_us)
539 { 515 return;
540 /* now! */ 516
541 pl->hello_req = 517 want = GNUNET_HELLO_size (fah.result->hello);
542 GNUNET_CORE_notify_transmit_ready (handle, GNUNET_YES, 518 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
543 GNUNET_CORE_PRIO_BEST_EFFORT, 519 "Sending HELLO with %u bytes",
544 GNUNET_CONSTANTS_SERVICE_TIMEOUT, 520 (unsigned int) want);
545 &pl->pid, next_want, 521 env = GNUNET_MQ_msg_copy (&fah.result->hello->header);
546 &hello_advertising_ready, pl); 522 GNUNET_MQ_send (pl->mq,
547 } 523 env);
524
525 /* avoid sending this one again soon */
526 GNUNET_CRYPTO_hash (&pl->pid,
527 sizeof (struct GNUNET_PeerIdentity),
528 &hc);
529 GNUNET_CONTAINER_bloomfilter_add (fah.result->filter,
530 &hc);
531
532 GNUNET_STATISTICS_update (stats,
533 gettext_noop ("# HELLO messages gossipped"),
534 1,
535 GNUNET_NO);
536 /* prepare to send the next one */
537 if (NULL != pl->hello_delay_task)
538 GNUNET_SCHEDULER_cancel (pl->hello_delay_task);
539 pl->next_hello_allowed
540 = GNUNET_TIME_relative_to_absolute (HELLO_ADVERTISEMENT_MIN_FREQUENCY);
541 pl->hello_delay_task
542 = GNUNET_SCHEDULER_add_now (&schedule_next_hello,
543 pl);
548} 544}
549 545
550 546
@@ -568,14 +564,9 @@ reschedule_hellos (void *cls,
568 564
569 if (skip == peer) 565 if (skip == peer)
570 return GNUNET_YES; 566 return GNUNET_YES;
571 if (!peer->is_connected) 567 if (NULL == peer->mq)
572 return GNUNET_YES; 568 return GNUNET_YES;
573 if (peer->hello_req != NULL) 569 if (NULL != peer->hello_delay_task)
574 {
575 GNUNET_CORE_notify_transmit_ready_cancel (peer->hello_req);
576 peer->hello_req = NULL;
577 }
578 if (peer->hello_delay_task != NULL)
579 { 570 {
580 GNUNET_SCHEDULER_cancel (peer->hello_delay_task); 571 GNUNET_SCHEDULER_cancel (peer->hello_delay_task);
581 peer->hello_delay_task = NULL; 572 peer->hello_delay_task = NULL;
@@ -591,12 +582,17 @@ reschedule_hellos (void *cls,
591 * 582 *
592 * @param cls closure 583 * @param cls closure
593 * @param peer peer identity this notification is about 584 * @param peer peer identity this notification is about
585 * @param mq message queue for communicating with @a peer
586 * @return our `struct Peer` for @a peer
594 */ 587 */
595static void 588static void *
596connect_notify (void *cls, 589connect_notify (void *cls,
597 const struct GNUNET_PeerIdentity *peer) 590 const struct GNUNET_PeerIdentity *peer,
591 struct GNUNET_MQ_Handle *mq)
598{ 592{
599 struct Peer *pos; 593 struct Peer *pos;
594 uint64_t flags;
595 const void *extra;
600 596
601 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 597 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
602 "Core told us that we are connecting to `%s'\n", 598 "Core told us that we are connecting to `%s'\n",
@@ -604,8 +600,13 @@ connect_notify (void *cls,
604 if (0 == memcmp (&my_identity, 600 if (0 == memcmp (&my_identity,
605 peer, 601 peer,
606 sizeof (struct GNUNET_PeerIdentity))) 602 sizeof (struct GNUNET_PeerIdentity)))
607 return; 603 return NULL;
608 604 extra = GNUNET_CORE_get_mq_options (GNUNET_YES,
605 GNUNET_CORE_PRIO_BEST_EFFORT,
606 &flags);
607 GNUNET_MQ_set_options (mq,
608 flags,
609 extra);
609 connection_count++; 610 connection_count++;
610 GNUNET_STATISTICS_set (stats, 611 GNUNET_STATISTICS_set (stats,
611 gettext_noop ("# peers connected"), 612 gettext_noop ("# peers connected"),
@@ -621,9 +622,9 @@ connect_notify (void *cls,
621 } 622 }
622 else 623 else
623 { 624 {
624 GNUNET_assert (GNUNET_NO == pos->is_connected); 625 GNUNET_assert (NULL == pos->mq);
625 } 626 }
626 pos->is_connected = GNUNET_YES; 627 pos->mq = mq;
627 if (pos->is_friend) 628 if (pos->is_friend)
628 { 629 {
629 friend_count++; 630 friend_count++;
@@ -638,6 +639,7 @@ connect_notify (void *cls,
638 reschedule_hellos (NULL, 639 reschedule_hellos (NULL,
639 peer, 640 peer,
640 pos); 641 pos);
642 return pos;
641} 643}
642 644
643 645
@@ -682,38 +684,27 @@ add_peer_task (void *cls)
682 * 684 *
683 * @param cls closure 685 * @param cls closure
684 * @param peer peer identity this notification is about 686 * @param peer peer identity this notification is about
687 * @param internal_cls the `struct Peer` for this peer
685 */ 688 */
686static void 689static void
687disconnect_notify (void *cls, 690disconnect_notify (void *cls,
688 const struct GNUNET_PeerIdentity *peer) 691 const struct GNUNET_PeerIdentity *peer,
692 void *internal_cls)
689{ 693{
690 struct Peer *pos; 694 struct Peer *pos = internal_cls;
691 695
692 if (0 == memcmp (&my_identity, 696 if (NULL == pos)
693 peer, 697 return; /* myself, we're shutting down */
694 sizeof (struct GNUNET_PeerIdentity)))
695 return;
696 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 698 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
697 "Core told us that we disconnected from `%s'\n", 699 "Core told us that we disconnected from `%s'\n",
698 GNUNET_i2s (peer)); 700 GNUNET_i2s (peer));
699 pos = GNUNET_CONTAINER_multipeermap_get (peers, peer); 701 if (NULL == pos->mq)
700 if (NULL == pos)
701 { 702 {
702 GNUNET_break (0); 703 GNUNET_break (0);
703 return; 704 return;
704 } 705 }
705 if (GNUNET_YES != pos->is_connected) 706 pos->mq = NULL;
706 {
707 GNUNET_break (0);
708 return;
709 }
710 pos->is_connected = GNUNET_NO;
711 connection_count--; 707 connection_count--;
712 if (NULL != pos->hello_req)
713 {
714 GNUNET_CORE_notify_transmit_ready_cancel (pos->hello_req);
715 pos->hello_req = NULL;
716 }
717 if (NULL != pos->hello_delay_task) 708 if (NULL != pos->hello_delay_task)
718 { 709 {
719 GNUNET_SCHEDULER_cancel (pos->hello_delay_task); 710 GNUNET_SCHEDULER_cancel (pos->hello_delay_task);
@@ -891,7 +882,7 @@ process_peer (void *cls,
891 GNUNET_CONTAINER_bloomfilter_free (pos->filter); 882 GNUNET_CONTAINER_bloomfilter_free (pos->filter);
892 pos->filter = NULL; 883 pos->filter = NULL;
893 } 884 }
894 if ( (GNUNET_NO == pos->is_connected) && 885 if ( (NULL == pos->mq) &&
895 (GNUNET_NO == pos->is_friend) ) 886 (GNUNET_NO == pos->is_friend) )
896 free_peer (NULL, 887 free_peer (NULL,
897 &pos->pid, 888 &pos->pid,
@@ -911,7 +902,7 @@ process_peer (void *cls,
911 902
912 903
913/** 904/**
914 * Function called after #GNUNET_CORE_connect has succeeded 905 * Function called after #GNUNET_CORE_connecT has succeeded
915 * (or failed for good). 906 * (or failed for good).
916 * 907 *
917 * @param cls closure 908 * @param cls closure
@@ -1021,115 +1012,76 @@ done_offer_hello (void *cls)
1021 * This function is called whenever an encrypted HELLO message is 1012 * This function is called whenever an encrypted HELLO message is
1022 * received. 1013 * received.
1023 * 1014 *
1024 * @param cls closure 1015 * @param cls closure with the peer identity of the sender
1025 * @param other the other peer involved (sender or receiver, NULL
1026 * for loopback messages where we are both sender and receiver)
1027 * @param message the actual HELLO message 1016 * @param message the actual HELLO message
1028 * @return #GNUNET_OK to keep the connection open, 1017 * @return #GNUNET_OK if @a message is well-formed
1029 * #GNUNET_SYSERR to close it (signal serious error) 1018 * #GNUNET_SYSERR if @a message is invalid
1030 */ 1019 */
1031static int 1020static int
1032handle_encrypted_hello (void *cls, 1021check_hello (void *cls,
1033 const struct GNUNET_PeerIdentity *other, 1022 const struct GNUNET_HELLO_Message *message)
1034 const struct GNUNET_MessageHeader *message)
1035{ 1023{
1036 struct Peer *peer;
1037 struct GNUNET_PeerIdentity pid; 1024 struct GNUNET_PeerIdentity pid;
1038 1025
1039 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1040 "Received encrypted HELLO from peer `%s'",
1041 GNUNET_i2s (other));
1042 if (GNUNET_OK != 1026 if (GNUNET_OK !=
1043 GNUNET_HELLO_get_id ((const struct GNUNET_HELLO_Message *) message, &pid)) 1027 GNUNET_HELLO_get_id (message,
1028 &pid))
1044 { 1029 {
1045 GNUNET_break_op (0); 1030 GNUNET_break_op (0);
1046 return GNUNET_SYSERR; 1031 return GNUNET_SYSERR;
1047 } 1032 }
1033 return GNUNET_OK;
1034}
1035
1036
1037/**
1038 * This function is called whenever an encrypted HELLO message is
1039 * received.
1040 *
1041 * @param cls closure with the peer identity of the sender
1042 * @param message the actual HELLO message
1043 */
1044static void
1045handle_hello (void *cls,
1046 const struct GNUNET_HELLO_Message *message)
1047{
1048 const struct GNUNET_PeerIdentity *other = cls;
1049 struct Peer *peer;
1050 struct GNUNET_PeerIdentity pid;
1051
1052 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1053 "Received encrypted HELLO from peer `%s'",
1054 GNUNET_i2s (other));
1055 GNUNET_assert (GNUNET_OK ==
1056 GNUNET_HELLO_get_id (message,
1057 &pid));
1048 GNUNET_STATISTICS_update (stats, 1058 GNUNET_STATISTICS_update (stats,
1049 gettext_noop ("# HELLO messages received"), 1059 gettext_noop ("# HELLO messages received"),
1050 1, 1060 1,
1051 GNUNET_NO); 1061 GNUNET_NO);
1052 peer = GNUNET_CONTAINER_multipeermap_get (peers, &pid); 1062 peer = GNUNET_CONTAINER_multipeermap_get (peers,
1063 &pid);
1053 if (NULL == peer) 1064 if (NULL == peer)
1054 { 1065 {
1055 if ( (GNUNET_YES == friends_only) || 1066 if ( (GNUNET_YES == friends_only) ||
1056 (friend_count < minimum_friend_count) ) 1067 (friend_count < minimum_friend_count) )
1057 return GNUNET_OK; 1068 return;
1058 } 1069 }
1059 else 1070 else
1060 { 1071 {
1061 if ( (GNUNET_YES != peer->is_friend) && 1072 if ( (GNUNET_YES != peer->is_friend) &&
1062 (GNUNET_YES == friends_only) ) 1073 (GNUNET_YES == friends_only) )
1063 return GNUNET_OK; 1074 return;
1064 if ((GNUNET_YES != peer->is_friend) && 1075 if ((GNUNET_YES != peer->is_friend) &&
1065 (friend_count < minimum_friend_count)) 1076 (friend_count < minimum_friend_count))
1066 return GNUNET_OK; 1077 return;
1067 } 1078 }
1068 if (NULL != oh) 1079 if (NULL != oh)
1069 GNUNET_TRANSPORT_offer_hello_cancel (oh); 1080 GNUNET_TRANSPORT_offer_hello_cancel (oh);
1070 oh = GNUNET_TRANSPORT_offer_hello (cfg, 1081 oh = GNUNET_TRANSPORT_offer_hello (cfg,
1071 message, 1082 &message->header,
1072 &done_offer_hello, 1083 &done_offer_hello,
1073 NULL); 1084 NULL);
1074 return GNUNET_OK;
1075}
1076
1077
1078/**
1079 * Function to fill send buffer with HELLO.
1080 *
1081 * @param cls `struct Peer` of the target peer
1082 * @param size number of bytes available in buf
1083 * @param buf where the callee should write the message
1084 * @return number of bytes written to buf
1085 */
1086static size_t
1087hello_advertising_ready (void *cls,
1088 size_t size,
1089 void *buf)
1090{
1091 struct Peer *pl = cls;
1092 struct FindAdvHelloContext fah;
1093 size_t want;
1094 struct GNUNET_HashCode hc;
1095
1096 pl->hello_req = NULL;
1097 GNUNET_assert (GNUNET_YES == pl->is_connected);
1098 /* find applicable HELLOs */
1099 fah.peer = pl;
1100 fah.result = NULL;
1101 fah.max_size = size;
1102 fah.next_adv = GNUNET_TIME_UNIT_FOREVER_REL;
1103 GNUNET_CONTAINER_multipeermap_iterate (peers,
1104 &find_advertisable_hello,
1105 &fah);
1106 want = 0;
1107 if (NULL != fah.result)
1108 {
1109 want = GNUNET_HELLO_size (fah.result->hello);
1110 GNUNET_assert (want <= size);
1111 GNUNET_memcpy (buf,
1112 fah.result->hello,
1113 want);
1114 GNUNET_CRYPTO_hash (&pl->pid,
1115 sizeof (struct GNUNET_PeerIdentity),
1116 &hc);
1117 GNUNET_CONTAINER_bloomfilter_add (fah.result->filter,
1118 &hc);
1119 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1120 "Sending HELLO with %u bytes",
1121 (unsigned int) want);
1122 GNUNET_STATISTICS_update (stats,
1123 gettext_noop ("# HELLO messages gossipped"), 1,
1124 GNUNET_NO);
1125 }
1126
1127 if (pl->hello_delay_task != NULL)
1128 GNUNET_SCHEDULER_cancel (pl->hello_delay_task);
1129 pl->next_hello_allowed =
1130 GNUNET_TIME_relative_to_absolute (HELLO_ADVERTISEMENT_MIN_FREQUENCY);
1131 pl->hello_delay_task = GNUNET_SCHEDULER_add_now (&schedule_next_hello, pl);
1132 return want;
1133} 1085}
1134 1086
1135 1087
@@ -1149,7 +1101,7 @@ cleaning_task (void *cls)
1149 } 1101 }
1150 if (NULL != handle) 1102 if (NULL != handle)
1151 { 1103 {
1152 GNUNET_CORE_disconnect (handle); 1104 GNUNET_CORE_disconnecT (handle);
1153 handle = NULL; 1105 handle = NULL;
1154 } 1106 }
1155 whitelist_peers (); 1107 whitelist_peers ();
@@ -1195,9 +1147,12 @@ run (void *cls,
1195 const char *cfgfile, 1147 const char *cfgfile,
1196 const struct GNUNET_CONFIGURATION_Handle *c) 1148 const struct GNUNET_CONFIGURATION_Handle *c)
1197{ 1149{
1198 static struct GNUNET_CORE_MessageHandler handlers[] = { 1150 GNUNET_MQ_hd_var_size (hello,
1199 {&handle_encrypted_hello, GNUNET_MESSAGE_TYPE_HELLO, 0}, 1151 GNUNET_MESSAGE_TYPE_HELLO,
1200 {NULL, 0, 0} 1152 struct GNUNET_HELLO_Message);
1153 struct GNUNET_MQ_MessageHandler handlers[] = {
1154 make_hello_handler (NULL),
1155 GNUNET_MQ_handler_end ()
1201 }; 1156 };
1202 unsigned long long opt; 1157 unsigned long long opt;
1203 1158
@@ -1234,14 +1189,12 @@ run (void *cls,
1234 &blacklist_check, 1189 &blacklist_check,
1235 NULL); 1190 NULL);
1236 ats = GNUNET_ATS_connectivity_init (cfg); 1191 ats = GNUNET_ATS_connectivity_init (cfg);
1237 handle = 1192 handle = GNUNET_CORE_connecT (cfg,
1238 GNUNET_CORE_connect (cfg, NULL, 1193 NULL,
1239 &core_init, 1194 &core_init,
1240 &connect_notify, 1195 &connect_notify,
1241 &disconnect_notify, 1196 &disconnect_notify,
1242 NULL, GNUNET_NO, 1197 handlers);
1243 NULL, GNUNET_NO,
1244 handlers);
1245 GNUNET_SCHEDULER_add_shutdown (&cleaning_task, 1198 GNUNET_SCHEDULER_add_shutdown (&cleaning_task,
1246 NULL); 1199 NULL);
1247 if (NULL == handle) 1200 if (NULL == handle)
@@ -1290,7 +1243,8 @@ main (int argc, char *const *argv)
1290/** 1243/**
1291 * MINIMIZE heap size (way below 128k) since this process doesn't need much. 1244 * MINIMIZE heap size (way below 128k) since this process doesn't need much.
1292 */ 1245 */
1293void __attribute__ ((constructor)) GNUNET_ARM_memory_init () 1246void __attribute__ ((constructor))
1247GNUNET_ARM_memory_init ()
1294{ 1248{
1295 mallopt (M_TRIM_THRESHOLD, 4 * 1024); 1249 mallopt (M_TRIM_THRESHOLD, 4 * 1024);
1296 mallopt (M_TOP_PAD, 1 * 1024); 1250 mallopt (M_TOP_PAD, 1 * 1024);