aboutsummaryrefslogtreecommitdiff
path: root/src/rps/gnunet-service-rps.c
diff options
context:
space:
mode:
authorJulius Bünger <buenger@mytum.de>2015-02-16 18:56:22 +0000
committerJulius Bünger <buenger@mytum.de>2015-02-16 18:56:22 +0000
commitf4215c5cfa1a76c75aee6ceff1da057f2fa20c2a (patch)
tree2ce680cb7d321b04faeb87dcce8ee9a0eb8e27a6 /src/rps/gnunet-service-rps.c
parent0f5f329643649dfadc85a89273b845d1854e8f6d (diff)
downloadgnunet-f4215c5cfa1a76c75aee6ceff1da057f2fa20c2a.tar.gz
gnunet-f4215c5cfa1a76c75aee6ceff1da057f2fa20c2a.zip
- fixed slow startup of service
Diffstat (limited to 'src/rps/gnunet-service-rps.c')
-rw-r--r--src/rps/gnunet-service-rps.c57
1 files changed, 29 insertions, 28 deletions
diff --git a/src/rps/gnunet-service-rps.c b/src/rps/gnunet-service-rps.c
index d2a8fa0d0..489e415c6 100644
--- a/src/rps/gnunet-service-rps.c
+++ b/src/rps/gnunet-service-rps.c
@@ -1487,11 +1487,9 @@ init_peer_cb (void *cls,
1487 unsigned int best_path) // "How long is the best path? 1487 unsigned int best_path) // "How long is the best path?
1488 // (0 = unknown, 1 = ourselves, 2 = neighbor)" 1488 // (0 = unknown, 1 = ourselves, 2 = neighbor)"
1489{ 1489{
1490 struct GNUNET_SERVER_Handle *server;
1491 struct PeerOutstandingOp out_op; 1490 struct PeerOutstandingOp out_op;
1492 struct PeerContext *peer_ctx; 1491 struct PeerContext *peer_ctx;
1493 1492
1494 server = (struct GNUNET_SERVER_Handle *) cls;
1495 if (NULL != peer 1493 if (NULL != peer
1496 && 0 != GNUNET_CRYPTO_cmp_peer_identity (&own_identity, peer)) 1494 && 0 != GNUNET_CRYPTO_cmp_peer_identity (&own_identity, peer))
1497 { 1495 {
@@ -1501,32 +1499,32 @@ init_peer_cb (void *cls,
1501 1499
1502 // maybe create a function for that 1500 // maybe create a function for that
1503 peer_ctx = get_peer_ctx (peer_map, peer); 1501 peer_ctx = get_peer_ctx (peer_map, peer);
1504 // FIXME this peer might already be marked as LIVE 1502 if (GNUNET_YES != get_peer_flag (peer_ctx, VALID))
1505 if (GNUNET_NO == insert_in_sampler_scheduled (peer_ctx))
1506 { 1503 {
1507 out_op.op = insert_in_sampler; 1504 if (GNUNET_NO == insert_in_sampler_scheduled (peer_ctx))
1508 out_op.op_cls = NULL; 1505 {
1509 GNUNET_array_append (peer_ctx->outstanding_ops, 1506 out_op.op = insert_in_sampler;
1510 peer_ctx->num_outstanding_ops, 1507 out_op.op_cls = NULL;
1511 out_op); 1508 GNUNET_array_append (peer_ctx->outstanding_ops,
1512 } 1509 peer_ctx->num_outstanding_ops,
1510 out_op);
1511 }
1513 1512
1514 if (GNUNET_NO == insert_in_gossip_list_scheduled (peer_ctx)) 1513 if (GNUNET_NO == insert_in_gossip_list_scheduled (peer_ctx))
1515 { 1514 {
1516 out_op.op = insert_in_gossip_list; 1515 out_op.op = insert_in_gossip_list;
1517 out_op.op_cls = NULL; 1516 out_op.op_cls = NULL;
1518 GNUNET_array_append (peer_ctx->outstanding_ops, 1517 GNUNET_array_append (peer_ctx->outstanding_ops,
1519 peer_ctx->num_outstanding_ops, 1518 peer_ctx->num_outstanding_ops,
1520 out_op); 1519 out_op);
1521 } 1520 }
1522 1521
1523 /* Trigger livelyness test on peer */ 1522 /* Trigger livelyness test on peer */
1524 (void) get_channel (peer_map, peer); 1523 (void) get_channel (peer_map, peer);
1524 }
1525 1525
1526 // send push/pull to each of those peers? 1526 // send push/pull to each of those peers?
1527 } 1527 }
1528 else if (NULL == peer)
1529 rps_start (server);
1530} 1528}
1531 1529
1532 1530
@@ -1774,14 +1772,12 @@ rps_start (struct GNUNET_SERVER_Handle *server)
1774 LOG (GNUNET_ERROR_TYPE_DEBUG, "Ready to receive requests from clients\n"); 1772 LOG (GNUNET_ERROR_TYPE_DEBUG, "Ready to receive requests from clients\n");
1775 1773
1776 1774
1777 num_hist_update_tasks = 0;
1778
1779 do_round_task = GNUNET_SCHEDULER_add_now (&do_round, NULL); 1775 do_round_task = GNUNET_SCHEDULER_add_now (&do_round, NULL);
1780 LOG (GNUNET_ERROR_TYPE_DEBUG, "Scheduled first round\n"); 1776 LOG (GNUNET_ERROR_TYPE_DEBUG, "Scheduled first round\n");
1781 1777
1782 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, 1778 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL,
1783 &shutdown_task, 1779 &shutdown_task,
1784 NULL); 1780 NULL);
1785} 1781}
1786 1782
1787 1783
@@ -1886,10 +1882,15 @@ run (void *cls,
1886 pending_pull_reply_list_size = 0; 1882 pending_pull_reply_list_size = 0;
1887 1883
1888 1884
1889 LOG (GNUNET_ERROR_TYPE_DEBUG, "Requesting peers from CADET\n"); 1885 num_hist_update_tasks = 0;
1890 GNUNET_CADET_get_peers (cadet_handle, &init_peer_cb, server); 1886
1891 1887
1888 LOG (GNUNET_ERROR_TYPE_DEBUG, "Requesting peers from CADET\n");
1889 GNUNET_CADET_get_peers (cadet_handle, &init_peer_cb, NULL);
1892 // TODO send push/pull to each of those peers? 1890 // TODO send push/pull to each of those peers?
1891
1892
1893 rps_start (server);
1893} 1894}
1894 1895
1895 1896