diff options
author | Christian Grothoff <christian@grothoff.org> | 2011-03-27 10:32:30 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2011-03-27 10:32:30 +0000 |
commit | 817bbb71e3e583ec85d6d63ca3e0cbb90ccd7462 (patch) | |
tree | 7e9e8717e9f57b74fca3a0e93f0d4b94234a1dd3 /src/core | |
parent | 3814b7980a4ed1117be9659a3d10fa49cb4c16e9 (diff) | |
download | gnunet-817bbb71e3e583ec85d6d63ca3e0cbb90ccd7462.tar.gz gnunet-817bbb71e3e583ec85d6d63ca3e0cbb90ccd7462.zip |
communicate res delay in capi
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/core.h | 7 | ||||
-rw-r--r-- | src/core/core_api.c | 17 | ||||
-rw-r--r-- | src/core/gnunet-service-core.c | 7 |
3 files changed, 16 insertions, 15 deletions
diff --git a/src/core/core.h b/src/core/core.h index fff4c3fa8..8a8962124 100644 --- a/src/core/core.h +++ b/src/core/core.h | |||
@@ -301,6 +301,13 @@ struct ConfigurationInfoMessage | |||
301 | int32_t reserved_amount GNUNET_PACKED; | 301 | int32_t reserved_amount GNUNET_PACKED; |
302 | 302 | ||
303 | /** | 303 | /** |
304 | * If the reservation request could not be satisfied (reserved_amount | ||
305 | * was zero), how long should the client wait until retrying? 0 if | ||
306 | * bandwidth was reserved. | ||
307 | */ | ||
308 | struct GNUNET_TIME_RelativeNBO reserve_delay; | ||
309 | |||
310 | /** | ||
304 | * Unique request ID. | 311 | * Unique request ID. |
305 | */ | 312 | */ |
306 | uint32_t rim_id GNUNET_PACKED; | 313 | uint32_t rim_id GNUNET_PACKED; |
diff --git a/src/core/core_api.c b/src/core/core_api.c index 767ee2957..3b5440135 100644 --- a/src/core/core_api.c +++ b/src/core/core_api.c | |||
@@ -422,7 +422,9 @@ disconnect_and_free_peer_entry (void *cls, | |||
422 | pcic (pr->pcic_cls, | 422 | pcic (pr->pcic_cls, |
423 | &pr->peer, | 423 | &pr->peer, |
424 | zero, | 424 | zero, |
425 | 0, 0); | 425 | 0, |
426 | GNUNET_TIME_UNIT_FOREVER_REL, | ||
427 | 0); | ||
426 | } | 428 | } |
427 | if (pr->timeout_task != GNUNET_SCHEDULER_NO_TASK) | 429 | if (pr->timeout_task != GNUNET_SCHEDULER_NO_TASK) |
428 | { | 430 | { |
@@ -1252,6 +1254,7 @@ main_notify_handler (void *cls, | |||
1252 | &pr->peer, | 1254 | &pr->peer, |
1253 | cim->bw_out, | 1255 | cim->bw_out, |
1254 | ntohl (cim->reserved_amount), | 1256 | ntohl (cim->reserved_amount), |
1257 | GNUNET_TIME_relative_ntoh (cim->reserve_delay), | ||
1255 | GNUNET_ntohll (cim->preference)); | 1258 | GNUNET_ntohll (cim->preference)); |
1256 | break; | 1259 | break; |
1257 | default: | 1260 | default: |
@@ -1810,16 +1813,6 @@ struct GNUNET_CORE_InformationRequestContext | |||
1810 | struct GNUNET_CORE_Handle *h; | 1813 | struct GNUNET_CORE_Handle *h; |
1811 | 1814 | ||
1812 | /** | 1815 | /** |
1813 | * Function to call with the information. | ||
1814 | */ | ||
1815 | GNUNET_CORE_PeerConfigurationInfoCallback info; | ||
1816 | |||
1817 | /** | ||
1818 | * Closure for info. | ||
1819 | */ | ||
1820 | void *info_cls; | ||
1821 | |||
1822 | /** | ||
1823 | * Link to control message, NULL if CM was sent. | 1816 | * Link to control message, NULL if CM was sent. |
1824 | */ | 1817 | */ |
1825 | struct ControlMessage *cm; | 1818 | struct ControlMessage *cm; |
@@ -1903,8 +1896,6 @@ GNUNET_CORE_peer_change_preference (struct GNUNET_CORE_Handle *h, | |||
1903 | irc = GNUNET_malloc (sizeof (struct GNUNET_CORE_InformationRequestContext)); | 1896 | irc = GNUNET_malloc (sizeof (struct GNUNET_CORE_InformationRequestContext)); |
1904 | irc->h = h; | 1897 | irc->h = h; |
1905 | irc->pr = pr; | 1898 | irc->pr = pr; |
1906 | irc->info = info; | ||
1907 | irc->info_cls = info_cls; | ||
1908 | cm = GNUNET_malloc (sizeof (struct ControlMessage) + | 1899 | cm = GNUNET_malloc (sizeof (struct ControlMessage) + |
1909 | sizeof (struct RequestInfoMessage)); | 1900 | sizeof (struct RequestInfoMessage)); |
1910 | cm->cont = &change_preference_send_continuation; | 1901 | cm->cont = &change_preference_send_continuation; |
diff --git a/src/core/gnunet-service-core.c b/src/core/gnunet-service-core.c index 3068fd408..223430805 100644 --- a/src/core/gnunet-service-core.c +++ b/src/core/gnunet-service-core.c | |||
@@ -1571,6 +1571,7 @@ handle_client_request_info (void *cls, | |||
1571 | int32_t want_reserv; | 1571 | int32_t want_reserv; |
1572 | int32_t got_reserv; | 1572 | int32_t got_reserv; |
1573 | unsigned long long old_preference; | 1573 | unsigned long long old_preference; |
1574 | struct GNUNET_TIME_Relative rdelay; | ||
1574 | 1575 | ||
1575 | #if DEBUG_CORE_CLIENT | 1576 | #if DEBUG_CORE_CLIENT |
1576 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1577 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
@@ -1621,8 +1622,9 @@ handle_client_request_info (void *cls, | |||
1621 | } | 1622 | } |
1622 | else if (want_reserv > 0) | 1623 | else if (want_reserv > 0) |
1623 | { | 1624 | { |
1624 | if (GNUNET_BANDWIDTH_tracker_get_delay (&n->available_recv_window, | 1625 | rdelay = GNUNET_BANDWIDTH_tracker_get_delay (&n->available_recv_window, |
1625 | want_reserv).rel_value == 0) | 1626 | want_reserv); |
1627 | if (rdelay.rel_value == 0) | ||
1626 | got_reserv = want_reserv; | 1628 | got_reserv = want_reserv; |
1627 | else | 1629 | else |
1628 | got_reserv = 0; /* all or nothing */ | 1630 | got_reserv = 0; /* all or nothing */ |
@@ -1647,6 +1649,7 @@ handle_client_request_info (void *cls, | |||
1647 | (int) got_reserv); | 1649 | (int) got_reserv); |
1648 | #endif | 1650 | #endif |
1649 | cim.reserved_amount = htonl (got_reserv); | 1651 | cim.reserved_amount = htonl (got_reserv); |
1652 | cim.reserve_delay = GNUNET_TIME_relative_hton (rdelay); | ||
1650 | cim.rim_id = rcm->rim_id; | 1653 | cim.rim_id = rcm->rim_id; |
1651 | cim.bw_out = n->bw_out; | 1654 | cim.bw_out = n->bw_out; |
1652 | cim.preference = n->current_preference; | 1655 | cim.preference = n->current_preference; |