aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--contrib/defaults.conf2
-rw-r--r--src/core/core.h7
-rw-r--r--src/core/core_api.c17
-rw-r--r--src/core/gnunet-service-core.c7
-rw-r--r--src/dht/gnunet-service-dht.c6
-rw-r--r--src/fs/gnunet-service-fs.c9
-rw-r--r--src/fs/gnunet-service-fs_cp.c6
-rw-r--r--src/include/gauger.h2
-rw-r--r--src/include/gnunet_core_service.h9
-rw-r--r--src/util/connection.c25
10 files changed, 62 insertions, 28 deletions
diff --git a/contrib/defaults.conf b/contrib/defaults.conf
index f0ee4e3e0..fe98f1d18 100644
--- a/contrib/defaults.conf
+++ b/contrib/defaults.conf
@@ -295,7 +295,7 @@ PORT = 2094
295HOSTNAME = localhost 295HOSTNAME = localhost
296HOME = $SERVICEHOME 296HOME = $SERVICEHOME
297CONFIG = $DEFAULTCONFIG 297CONFIG = $DEFAULTCONFIG
298BINARY = gnunet-service-fs 298BINARY = gnunet-service-fs-new
299ACCEPT_FROM = 127.0.0.1; 299ACCEPT_FROM = 127.0.0.1;
300ACCEPT_FROM6 = ::1; 300ACCEPT_FROM6 = ::1;
301 301
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;
diff --git a/src/dht/gnunet-service-dht.c b/src/dht/gnunet-service-dht.c
index 08cc7dc88..3311763cb 100644
--- a/src/dht/gnunet-service-dht.c
+++ b/src/dht/gnunet-service-dht.c
@@ -1466,13 +1466,17 @@ update_core_preference (void *cls,
1466 * @param bpm_out set to the current bandwidth limit (sending) for this peer 1466 * @param bpm_out set to the current bandwidth limit (sending) for this peer
1467 * @param amount set to the amount that was actually reserved or unreserved; 1467 * @param amount set to the amount that was actually reserved or unreserved;
1468 * either the full requested amount or zero (no partial reservations) 1468 * either the full requested amount or zero (no partial reservations)
1469 * @param res_delay if the reservation could not be satisfied (amount was 0), how
1470 * long should the client wait until re-trying?
1469 * @param preference current traffic preference for the given peer 1471 * @param preference current traffic preference for the given peer
1470 */ 1472 */
1471static void 1473static void
1472update_core_preference_finish (void *cls, 1474update_core_preference_finish (void *cls,
1473 const struct GNUNET_PeerIdentity *peer, 1475 const struct GNUNET_PeerIdentity *peer,
1474 struct GNUNET_BANDWIDTH_Value32NBO bpm_out, 1476 struct GNUNET_BANDWIDTH_Value32NBO bpm_out,
1475 int amount, uint64_t preference) 1477 int32_t amount,
1478 struct GNUNET_TIME_Relative res_delay,
1479 uint64_t preference)
1476{ 1480{
1477 struct PeerInfo *peer_info = cls; 1481 struct PeerInfo *peer_info = cls;
1478 peer_info->info_ctx = NULL; 1482 peer_info->info_ctx = NULL;
diff --git a/src/fs/gnunet-service-fs.c b/src/fs/gnunet-service-fs.c
index 687f131d1..74a88e7b2 100644
--- a/src/fs/gnunet-service-fs.c
+++ b/src/fs/gnunet-service-fs.c
@@ -2658,6 +2658,8 @@ refresh_bloomfilter (struct PendingRequest *pr)
2658 * @param peer identifies the peer 2658 * @param peer identifies the peer
2659 * @param bpm_out set to the current bandwidth limit (sending) for this peer 2659 * @param bpm_out set to the current bandwidth limit (sending) for this peer
2660 * @param amount set to the amount that was actually reserved or unreserved 2660 * @param amount set to the amount that was actually reserved or unreserved
2661 * @param res_delay if the reservation could not be satisfied (amount was 0), how
2662 * long should the client wait until re-trying?
2661 * @param preference current traffic preference for the given peer 2663 * @param preference current traffic preference for the given peer
2662 */ 2664 */
2663static void 2665static void
@@ -2665,7 +2667,8 @@ target_reservation_cb (void *cls,
2665 const struct 2667 const struct
2666 GNUNET_PeerIdentity * peer, 2668 GNUNET_PeerIdentity * peer,
2667 struct GNUNET_BANDWIDTH_Value32NBO bpm_out, 2669 struct GNUNET_BANDWIDTH_Value32NBO bpm_out,
2668 int amount, 2670 int32_t amount,
2671 struct GNUNET_TIME_Relative res_delay,
2669 uint64_t preference) 2672 uint64_t preference)
2670{ 2673{
2671 struct PendingRequest *pr = cls; 2674 struct PendingRequest *pr = cls;
@@ -3175,7 +3178,9 @@ forward_request_task (void *cls,
3175 /* force forwarding */ 3178 /* force forwarding */
3176 static struct GNUNET_BANDWIDTH_Value32NBO zerobw; 3179 static struct GNUNET_BANDWIDTH_Value32NBO zerobw;
3177 target_reservation_cb (pr, &psc.target, 3180 target_reservation_cb (pr, &psc.target,
3178 zerobw, 0, 0.0); 3181 zerobw, 0,
3182 GNUNET_TIME_UNIT_FOREVER_REL,
3183 0.0);
3179 } 3184 }
3180} 3185}
3181 3186
diff --git a/src/fs/gnunet-service-fs_cp.c b/src/fs/gnunet-service-fs_cp.c
index 783bd4024..05638b657 100644
--- a/src/fs/gnunet-service-fs_cp.c
+++ b/src/fs/gnunet-service-fs_cp.c
@@ -330,13 +330,16 @@ peer_transmit_ready_cb (void *cls,
330 * @param bandwidth_out available amount of outbound bandwidth 330 * @param bandwidth_out available amount of outbound bandwidth
331 * @param amount set to the amount that was actually reserved or unreserved; 331 * @param amount set to the amount that was actually reserved or unreserved;
332 * either the full requested amount or zero (no partial reservations) 332 * either the full requested amount or zero (no partial reservations)
333 * @param res_delay if the reservation could not be satisfied (amount was 0), how
334 * long should the client wait until re-trying?
333 * @param preference current traffic preference for the given peer 335 * @param preference current traffic preference for the given peer
334 */ 336 */
335static void 337static void
336core_reserve_callback (void *cls, 338core_reserve_callback (void *cls,
337 const struct GNUNET_PeerIdentity *peer, 339 const struct GNUNET_PeerIdentity *peer,
338 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, 340 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out,
339 int amount, 341 int32_t amount,
342 struct GNUNET_TIME_Relative res_delay,
340 uint64_t preference) 343 uint64_t preference)
341{ 344{
342 struct GSF_ConnectedPeer *cp = cls; 345 struct GSF_ConnectedPeer *cp = cls;
@@ -347,6 +350,7 @@ core_reserve_callback (void *cls,
347 if (0 == amount) 350 if (0 == amount)
348 { 351 {
349 /* failed; retry! (how did we get here!?) */ 352 /* failed; retry! (how did we get here!?) */
353 /* FIXME: wait res_delay before re-trying! */
350 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 354 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
351 _("Failed to reserve bandwidth to peer `%s'\n"), 355 _("Failed to reserve bandwidth to peer `%s'\n"),
352 GNUNET_i2s (peer)); 356 GNUNET_i2s (peer));
diff --git a/src/include/gauger.h b/src/include/gauger.h
index 8c4e9e3fb..206921d35 100644
--- a/src/include/gauger.h
+++ b/src/include/gauger.h
@@ -15,7 +15,7 @@
15#include <stdio.h> 15#include <stdio.h>
16#include <sys/wait.h> 16#include <sys/wait.h>
17 17
18#define GAUGER(category, counter, value, unit) {char* __gauger_v[10];char __gauger_s[32];pid_t __gauger_p; if(!(__gauger_p=fork())){if(!fork()){sprintf(__gauger_s,"%llu", (unsigned long long) (value));__gauger_v[0] = "gauger-cli.py";__gauger_v[1] = "-n";__gauger_v[2] = counter;__gauger_v[3] = "-d";__gauger_v[4] = __gauger_s;__gauger_v[5] = "-u";__gauger_v[6] = unit;__gauger_v[7] = "-c";__gauger_v[8] = category;__gauger_v[9] = (char *)NULL; close(2); execvp("gauger-cli.py",__gauger_v);perror("gauger");_exit(1);}else{_exit(0);}}else{waitpid(__gauger_p,NULL,0);}} 18#define GAUGER(category, counter, value, unit) {char* __gauger_v[10];char __gauger_s[32];pid_t __gauger_p; if(!(__gauger_p=fork())){if(!fork()){sprintf(__gauger_s,"%llu", (unsigned long long) (value));__gauger_v[0] = "gauger-cli.py";__gauger_v[1] = "-n";__gauger_v[2] = counter;__gauger_v[3] = "-d";__gauger_v[4] = __gauger_s;__gauger_v[5] = "-u";__gauger_v[6] = unit;__gauger_v[7] = "-c";__gauger_v[8] = category;__gauger_v[9] = (char *)NULL; close (2); execvp("gauger-cli.py",__gauger_v);perror("gauger");_exit(1);}else{_exit(0);}}else{waitpid(__gauger_p,NULL,0);}}
19 19
20#define GAUGER_ID(category, counter, value, unit, id) {char* __gauger_v[12];char __gauger_s[32];pid_t __gauger_p; if(!(__gauger_p=fork())){if(!fork()){sprintf(__gauger_s,"%llu", (unsigned long long) (value));__gauger_v[0] = "gauger-cli.py";__gauger_v[1] = "-n";__gauger_v[2] = counter;__gauger_v[3] = "-d";__gauger_v[4] = __gauger_s;__gauger_v[5] = "-u";__gauger_v[6] = unit;__gauger_v[7] = "-i";__gauger_v[8] = id;__gauger_v[9] = "-c";__gauger_v[10] = category;__gauger_v[11] = (char *)NULL; close(2); execvp("gauger-cli.py",__gauger_v);perror("gauger");_exit(1);}else{_exit(0);}}else{waitpid(__gauger_p,NULL,0);}} 20#define GAUGER_ID(category, counter, value, unit, id) {char* __gauger_v[12];char __gauger_s[32];pid_t __gauger_p; if(!(__gauger_p=fork())){if(!fork()){sprintf(__gauger_s,"%llu", (unsigned long long) (value));__gauger_v[0] = "gauger-cli.py";__gauger_v[1] = "-n";__gauger_v[2] = counter;__gauger_v[3] = "-d";__gauger_v[4] = __gauger_s;__gauger_v[5] = "-u";__gauger_v[6] = unit;__gauger_v[7] = "-i";__gauger_v[8] = id;__gauger_v[9] = "-c";__gauger_v[10] = category;__gauger_v[11] = (char *)NULL; close(2); execvp("gauger-cli.py",__gauger_v);perror("gauger");_exit(1);}else{_exit(0);}}else{waitpid(__gauger_p,NULL,0);}}
21 21
diff --git a/src/include/gnunet_core_service.h b/src/include/gnunet_core_service.h
index 755604b88..fd4375355 100644
--- a/src/include/gnunet_core_service.h
+++ b/src/include/gnunet_core_service.h
@@ -77,7 +77,7 @@ typedef void (*GNUNET_CORE_ConnectEventHandler) (void *cls,
77 */ 77 */
78typedef void (*GNUNET_CORE_PeerStatusEventHandler) (void *cls, 78typedef void (*GNUNET_CORE_PeerStatusEventHandler) (void *cls,
79 const struct 79 const struct
80 GNUNET_PeerIdentity * peer, 80 GNUNET_PeerIdentity *peer,
81 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, 81 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in,
82 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, 82 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out,
83 struct GNUNET_TIME_Absolute timeout, 83 struct GNUNET_TIME_Absolute timeout,
@@ -298,14 +298,17 @@ GNUNET_CORE_peer_request_connect_cancel (struct GNUNET_CORE_PeerRequestHandle *r
298 * @param bandwidth_out available amount of outbound bandwidth 298 * @param bandwidth_out available amount of outbound bandwidth
299 * @param amount set to the amount that was actually reserved or unreserved; 299 * @param amount set to the amount that was actually reserved or unreserved;
300 * either the full requested amount or zero (no partial reservations) 300 * either the full requested amount or zero (no partial reservations)
301 * @param res_delay if the reservation could not be satisfied (amount was 0), how
302 * long should the client wait until re-trying?
301 * @param preference current traffic preference for the given peer 303 * @param preference current traffic preference for the given peer
302 */ 304 */
303typedef void 305typedef void
304 (*GNUNET_CORE_PeerConfigurationInfoCallback) (void *cls, 306 (*GNUNET_CORE_PeerConfigurationInfoCallback) (void *cls,
305 const struct 307 const struct
306 GNUNET_PeerIdentity * peer, 308 GNUNET_PeerIdentity *peer,
307 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, 309 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out,
308 int amount, 310 int32_t amount,
311 struct GNUNET_TIME_Relative res_delay,
309 uint64_t preference); 312 uint64_t preference);
310 313
311 314
diff --git a/src/util/connection.c b/src/util/connection.c
index 737a6e15c..5dbc9916b 100644
--- a/src/util/connection.c
+++ b/src/util/connection.c
@@ -1372,9 +1372,13 @@ process_notify (struct GNUNET_CONNECTION_Handle *sock)
1372 * expired). 1372 * expired).
1373 * 1373 *
1374 * This task notifies the client about the timeout. 1374 * This task notifies the client about the timeout.
1375 *
1376 * @param cls the 'struct GNUNET_CONNECTION_Handle'
1377 * @param tc scheduler context
1375 */ 1378 */
1376static void 1379static void
1377transmit_timeout (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 1380transmit_timeout (void *cls,
1381 const struct GNUNET_SCHEDULER_TaskContext *tc)
1378{ 1382{
1379 struct GNUNET_CONNECTION_Handle *sock = cls; 1383 struct GNUNET_CONNECTION_Handle *sock = cls;
1380 GNUNET_CONNECTION_TransmitReadyNotify notify; 1384 GNUNET_CONNECTION_TransmitReadyNotify notify;
@@ -1403,15 +1407,23 @@ transmit_timeout (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
1403 * at the time of being asked to transmit. 1407 * at the time of being asked to transmit.
1404 * 1408 *
1405 * This task notifies the client about the error. 1409 * This task notifies the client about the error.
1410 *
1411 * @param cls the 'struct GNUNET_CONNECTION_Handle'
1412 * @param tc scheduler context
1406 */ 1413 */
1407static void 1414static void
1408connect_error (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 1415connect_error (void *cls,
1416 const struct GNUNET_SCHEDULER_TaskContext *tc)
1409{ 1417{
1410 struct GNUNET_CONNECTION_Handle *sock = cls; 1418 struct GNUNET_CONNECTION_Handle *sock = cls;
1411 GNUNET_CONNECTION_TransmitReadyNotify notify; 1419 GNUNET_CONNECTION_TransmitReadyNotify notify;
1420
1412 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1421 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1413 "Transmission request of size %u fails, connection failed (%p).\n", 1422 "Transmission request of size %u fails (%s/%u), connection failed (%p).\n",
1414 sock->nth.notify_size, sock); 1423 sock->nth.notify_size,
1424 sock->hostname,
1425 sock->port,
1426 sock);
1415#if DEBUG_CONNECTION 1427#if DEBUG_CONNECTION
1416 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1428 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1417 "Transmission request of size %u fails, connection failed (%p).\n", 1429 "Transmission request of size %u fails, connection failed (%p).\n",
@@ -1424,6 +1436,11 @@ connect_error (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
1424} 1436}
1425 1437
1426 1438
1439/**
1440 * FIXME
1441 *
1442 * @param sock FIXME
1443 */
1427static void 1444static void
1428transmit_error (struct GNUNET_CONNECTION_Handle *sock) 1445transmit_error (struct GNUNET_CONNECTION_Handle *sock)
1429{ 1446{