diff options
Diffstat (limited to 'src/fs/gnunet-service-fs.c')
-rw-r--r-- | src/fs/gnunet-service-fs.c | 57 |
1 files changed, 31 insertions, 26 deletions
diff --git a/src/fs/gnunet-service-fs.c b/src/fs/gnunet-service-fs.c index fd4ec74ed..139cb5aa9 100644 --- a/src/fs/gnunet-service-fs.c +++ b/src/fs/gnunet-service-fs.c | |||
@@ -1556,25 +1556,39 @@ destroy_pending_request (struct PendingRequest *pr) | |||
1556 | 1556 | ||
1557 | 1557 | ||
1558 | /** | 1558 | /** |
1559 | * Find latency information in 'atsi'. | ||
1560 | * | ||
1561 | * @param atsi performance data | ||
1562 | * @return connection latency | ||
1563 | */ | ||
1564 | static struct GNUNET_TIME_Relative | ||
1565 | get_latency (const struct GNUNET_TRANSPORT_ATS_Information *atsi) | ||
1566 | { | ||
1567 | /* FIXME: extract latency data from 'atsi' */ | ||
1568 | return GNUNET_TIME_UNIT_SECONDS; | ||
1569 | } | ||
1570 | |||
1571 | |||
1572 | /** | ||
1559 | * Method called whenever a given peer connects. | 1573 | * Method called whenever a given peer connects. |
1560 | * | 1574 | * |
1561 | * @param cls closure, not used | 1575 | * @param cls closure, not used |
1562 | * @param peer peer identity this notification is about | 1576 | * @param peer peer identity this notification is about |
1563 | * @param latency reported latency of the connection with 'other' | 1577 | * @param atsi performance information |
1564 | * @param distance reported distance (DV) to 'other' | ||
1565 | */ | 1578 | */ |
1566 | static void | 1579 | static void |
1567 | peer_connect_handler (void *cls, | 1580 | peer_connect_handler (void *cls, |
1568 | const struct | 1581 | const struct |
1569 | GNUNET_PeerIdentity * peer, | 1582 | GNUNET_PeerIdentity * peer, |
1570 | struct GNUNET_TIME_Relative latency, | 1583 | const struct GNUNET_TRANSPORT_ATS_Information *atsi) |
1571 | uint32_t distance) | ||
1572 | { | 1584 | { |
1573 | struct ConnectedPeer *cp; | 1585 | struct ConnectedPeer *cp; |
1574 | struct MigrationReadyBlock *pos; | 1586 | struct MigrationReadyBlock *pos; |
1575 | char *fn; | 1587 | char *fn; |
1576 | uint32_t trust; | 1588 | uint32_t trust; |
1589 | struct GNUNET_TIME_Relative latency; | ||
1577 | 1590 | ||
1591 | latency = get_latency (atsi); | ||
1578 | cp = GNUNET_CONTAINER_multihashmap_get (connected_peers, | 1592 | cp = GNUNET_CONTAINER_multihashmap_get (connected_peers, |
1579 | &peer->hashPubKey); | 1593 | &peer->hashPubKey); |
1580 | if (NULL != cp) | 1594 | if (NULL != cp) |
@@ -1612,25 +1626,25 @@ peer_connect_handler (void *cls, | |||
1612 | * | 1626 | * |
1613 | * @param cls closure | 1627 | * @param cls closure |
1614 | * @param peer peer identity this notification is about | 1628 | * @param peer peer identity this notification is about |
1615 | * @param latency reported latency of the connection with 'other' | ||
1616 | * @param distance reported distance (DV) to 'other' | ||
1617 | * @param bandwidth_in available amount of inbound bandwidth | 1629 | * @param bandwidth_in available amount of inbound bandwidth |
1618 | * @param bandwidth_out available amount of outbound bandwidth | 1630 | * @param bandwidth_out available amount of outbound bandwidth |
1619 | * @param timeout absolute time when this peer will time out | 1631 | * @param timeout absolute time when this peer will time out |
1620 | * unless we see some further activity from it | 1632 | * unless we see some further activity from it |
1633 | * @param atsi status information | ||
1621 | */ | 1634 | */ |
1622 | static void | 1635 | static void |
1623 | peer_status_handler (void *cls, | 1636 | peer_status_handler (void *cls, |
1624 | const struct | 1637 | const struct |
1625 | GNUNET_PeerIdentity * peer, | 1638 | GNUNET_PeerIdentity * peer, |
1626 | struct GNUNET_TIME_Relative latency, | ||
1627 | uint32_t distance, | ||
1628 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, | 1639 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, |
1629 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, | 1640 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, |
1630 | struct GNUNET_TIME_Absolute timeout) | 1641 | struct GNUNET_TIME_Absolute timeout, |
1642 | const struct GNUNET_TRANSPORT_ATS_Information *atsi) | ||
1631 | { | 1643 | { |
1632 | struct ConnectedPeer *cp; | 1644 | struct ConnectedPeer *cp; |
1645 | struct GNUNET_TIME_Relative latency; | ||
1633 | 1646 | ||
1647 | latency = get_latency (atsi); | ||
1634 | cp = GNUNET_CONTAINER_multihashmap_get (connected_peers, | 1648 | cp = GNUNET_CONTAINER_multihashmap_get (connected_peers, |
1635 | &peer->hashPubKey); | 1649 | &peer->hashPubKey); |
1636 | if (cp == NULL) | 1650 | if (cp == NULL) |
@@ -2529,7 +2543,6 @@ refresh_bloomfilter (struct PendingRequest *pr) | |||
2529 | * | 2543 | * |
2530 | * @param cls the requests "struct PendingRequest*" | 2544 | * @param cls the requests "struct PendingRequest*" |
2531 | * @param peer identifies the peer | 2545 | * @param peer identifies the peer |
2532 | * @param bpm_in set to the current bandwidth limit (receiving) for this peer | ||
2533 | * @param bpm_out set to the current bandwidth limit (sending) for this peer | 2546 | * @param bpm_out set to the current bandwidth limit (sending) for this peer |
2534 | * @param amount set to the amount that was actually reserved or unreserved | 2547 | * @param amount set to the amount that was actually reserved or unreserved |
2535 | * @param preference current traffic preference for the given peer | 2548 | * @param preference current traffic preference for the given peer |
@@ -2538,7 +2551,6 @@ static void | |||
2538 | target_reservation_cb (void *cls, | 2551 | target_reservation_cb (void *cls, |
2539 | const struct | 2552 | const struct |
2540 | GNUNET_PeerIdentity * peer, | 2553 | GNUNET_PeerIdentity * peer, |
2541 | struct GNUNET_BANDWIDTH_Value32NBO bpm_in, | ||
2542 | struct GNUNET_BANDWIDTH_Value32NBO bpm_out, | 2554 | struct GNUNET_BANDWIDTH_Value32NBO bpm_out, |
2543 | int amount, | 2555 | int amount, |
2544 | uint64_t preference) | 2556 | uint64_t preference) |
@@ -2984,7 +2996,7 @@ forward_request_task (void *cls, | |||
2984 | cp = GNUNET_CONTAINER_multihashmap_get (connected_peers, | 2996 | cp = GNUNET_CONTAINER_multihashmap_get (connected_peers, |
2985 | &psc.target.hashPubKey); | 2997 | &psc.target.hashPubKey); |
2986 | GNUNET_assert (NULL != cp); | 2998 | GNUNET_assert (NULL != cp); |
2987 | pr->irc = GNUNET_CORE_peer_change_preference (cfg, | 2999 | pr->irc = GNUNET_CORE_peer_change_preference (core, |
2988 | &psc.target, | 3000 | &psc.target, |
2989 | GNUNET_CONSTANTS_SERVICE_TIMEOUT, | 3001 | GNUNET_CONSTANTS_SERVICE_TIMEOUT, |
2990 | GNUNET_BANDWIDTH_value_init (UINT32_MAX), | 3002 | GNUNET_BANDWIDTH_value_init (UINT32_MAX), |
@@ -2999,7 +3011,7 @@ forward_request_task (void *cls, | |||
2999 | /* force forwarding */ | 3011 | /* force forwarding */ |
3000 | static struct GNUNET_BANDWIDTH_Value32NBO zerobw; | 3012 | static struct GNUNET_BANDWIDTH_Value32NBO zerobw; |
3001 | target_reservation_cb (pr, &psc.target, | 3013 | target_reservation_cb (pr, &psc.target, |
3002 | zerobw, zerobw, 0, 0.0); | 3014 | zerobw, 0, 0.0); |
3003 | } | 3015 | } |
3004 | } | 3016 | } |
3005 | 3017 | ||
@@ -3467,8 +3479,7 @@ put_migration_continuation (void *cls, | |||
3467 | * @param other the other peer involved (sender or receiver, NULL | 3479 | * @param other the other peer involved (sender or receiver, NULL |
3468 | * for loopback messages where we are both sender and receiver) | 3480 | * for loopback messages where we are both sender and receiver) |
3469 | * @param message the actual message | 3481 | * @param message the actual message |
3470 | * @param latency reported latency of the connection with 'other' | 3482 | * @param atsi performance information |
3471 | * @param distance reported distance (DV) to 'other' | ||
3472 | * @return GNUNET_OK to keep the connection open, | 3483 | * @return GNUNET_OK to keep the connection open, |
3473 | * GNUNET_SYSERR to close it (signal serious error) | 3484 | * GNUNET_SYSERR to close it (signal serious error) |
3474 | */ | 3485 | */ |
@@ -3476,8 +3487,7 @@ static int | |||
3476 | handle_p2p_put (void *cls, | 3487 | handle_p2p_put (void *cls, |
3477 | const struct GNUNET_PeerIdentity *other, | 3488 | const struct GNUNET_PeerIdentity *other, |
3478 | const struct GNUNET_MessageHeader *message, | 3489 | const struct GNUNET_MessageHeader *message, |
3479 | struct GNUNET_TIME_Relative latency, | 3490 | const struct GNUNET_TRANSPORT_ATS_Information *atsi) |
3480 | uint32_t distance) | ||
3481 | { | 3491 | { |
3482 | const struct PutMessage *put; | 3492 | const struct PutMessage *put; |
3483 | uint16_t msize; | 3493 | uint16_t msize; |
@@ -3608,8 +3618,7 @@ handle_p2p_put (void *cls, | |||
3608 | * @param other the other peer involved (sender or receiver, NULL | 3618 | * @param other the other peer involved (sender or receiver, NULL |
3609 | * for loopback messages where we are both sender and receiver) | 3619 | * for loopback messages where we are both sender and receiver) |
3610 | * @param message the actual message | 3620 | * @param message the actual message |
3611 | * @param latency reported latency of the connection with 'other' | 3621 | * @param atsi performance information |
3612 | * @param distance reported distance (DV) to 'other' | ||
3613 | * @return GNUNET_OK to keep the connection open, | 3622 | * @return GNUNET_OK to keep the connection open, |
3614 | * GNUNET_SYSERR to close it (signal serious error) | 3623 | * GNUNET_SYSERR to close it (signal serious error) |
3615 | */ | 3624 | */ |
@@ -3617,8 +3626,7 @@ static int | |||
3617 | handle_p2p_migration_stop (void *cls, | 3626 | handle_p2p_migration_stop (void *cls, |
3618 | const struct GNUNET_PeerIdentity *other, | 3627 | const struct GNUNET_PeerIdentity *other, |
3619 | const struct GNUNET_MessageHeader *message, | 3628 | const struct GNUNET_MessageHeader *message, |
3620 | struct GNUNET_TIME_Relative latency, | 3629 | const struct GNUNET_TRANSPORT_ATS_Information *atsi) |
3621 | uint32_t distance) | ||
3622 | { | 3630 | { |
3623 | struct ConnectedPeer *cp; | 3631 | struct ConnectedPeer *cp; |
3624 | const struct MigrationStopMessage *msm; | 3632 | const struct MigrationStopMessage *msm; |
@@ -3955,8 +3963,7 @@ check_duplicate_request_peer (void *cls, | |||
3955 | * @param other the other peer involved (sender or receiver, NULL | 3963 | * @param other the other peer involved (sender or receiver, NULL |
3956 | * for loopback messages where we are both sender and receiver) | 3964 | * for loopback messages where we are both sender and receiver) |
3957 | * @param message the actual message | 3965 | * @param message the actual message |
3958 | * @param latency reported latency of the connection with 'other' | 3966 | * @param atsi performance information |
3959 | * @param distance reported distance (DV) to 'other' | ||
3960 | * @return GNUNET_OK to keep the connection open, | 3967 | * @return GNUNET_OK to keep the connection open, |
3961 | * GNUNET_SYSERR to close it (signal serious error) | 3968 | * GNUNET_SYSERR to close it (signal serious error) |
3962 | */ | 3969 | */ |
@@ -3964,8 +3971,7 @@ static int | |||
3964 | handle_p2p_get (void *cls, | 3971 | handle_p2p_get (void *cls, |
3965 | const struct GNUNET_PeerIdentity *other, | 3972 | const struct GNUNET_PeerIdentity *other, |
3966 | const struct GNUNET_MessageHeader *message, | 3973 | const struct GNUNET_MessageHeader *message, |
3967 | struct GNUNET_TIME_Relative latency, | 3974 | const struct GNUNET_TRANSPORT_ATS_Information *atsi) |
3968 | uint32_t distance) | ||
3969 | { | 3975 | { |
3970 | struct PendingRequest *pr; | 3976 | struct PendingRequest *pr; |
3971 | struct ConnectedPeer *cp; | 3977 | struct ConnectedPeer *cp; |
@@ -4491,7 +4497,6 @@ main_init (struct GNUNET_SERVER_Handle *server, | |||
4491 | requests_by_expiration_heap = GNUNET_CONTAINER_heap_create (GNUNET_CONTAINER_HEAP_ORDER_MIN); | 4497 | requests_by_expiration_heap = GNUNET_CONTAINER_heap_create (GNUNET_CONTAINER_HEAP_ORDER_MIN); |
4492 | core = GNUNET_CORE_connect (cfg, | 4498 | core = GNUNET_CORE_connect (cfg, |
4493 | 1, /* larger? */ | 4499 | 1, /* larger? */ |
4494 | GNUNET_TIME_UNIT_FOREVER_REL, | ||
4495 | NULL, | 4500 | NULL, |
4496 | NULL, | 4501 | NULL, |
4497 | &peer_connect_handler, | 4502 | &peer_connect_handler, |