[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r14737 - in gnunet: contrib src/core src/dht src/fs src/inc
From: |
gnunet |
Subject: |
[GNUnet-SVN] r14737 - in gnunet: contrib src/core src/dht src/fs src/include src/util |
Date: |
Sun, 27 Mar 2011 12:32:30 +0200 |
Author: grothoff
Date: 2011-03-27 12:32:30 +0200 (Sun, 27 Mar 2011)
New Revision: 14737
Modified:
gnunet/contrib/defaults.conf
gnunet/src/core/core.h
gnunet/src/core/core_api.c
gnunet/src/core/gnunet-service-core.c
gnunet/src/dht/gnunet-service-dht.c
gnunet/src/fs/gnunet-service-fs.c
gnunet/src/fs/gnunet-service-fs_cp.c
gnunet/src/include/gauger.h
gnunet/src/include/gnunet_core_service.h
gnunet/src/util/connection.c
Log:
communicate res delay in capi
Modified: gnunet/contrib/defaults.conf
===================================================================
--- gnunet/contrib/defaults.conf 2011-03-25 19:36:58 UTC (rev 14736)
+++ gnunet/contrib/defaults.conf 2011-03-27 10:32:30 UTC (rev 14737)
@@ -295,7 +295,7 @@
HOSTNAME = localhost
HOME = $SERVICEHOME
CONFIG = $DEFAULTCONFIG
-BINARY = gnunet-service-fs
+BINARY = gnunet-service-fs-new
ACCEPT_FROM = 127.0.0.1;
ACCEPT_FROM6 = ::1;
Modified: gnunet/src/core/core.h
===================================================================
--- gnunet/src/core/core.h 2011-03-25 19:36:58 UTC (rev 14736)
+++ gnunet/src/core/core.h 2011-03-27 10:32:30 UTC (rev 14737)
@@ -301,6 +301,13 @@
int32_t reserved_amount GNUNET_PACKED;
/**
+ * If the reservation request could not be satisfied (reserved_amount
+ * was zero), how long should the client wait until retrying? 0 if
+ * bandwidth was reserved.
+ */
+ struct GNUNET_TIME_RelativeNBO reserve_delay;
+
+ /**
* Unique request ID.
*/
uint32_t rim_id GNUNET_PACKED;
Modified: gnunet/src/core/core_api.c
===================================================================
--- gnunet/src/core/core_api.c 2011-03-25 19:36:58 UTC (rev 14736)
+++ gnunet/src/core/core_api.c 2011-03-27 10:32:30 UTC (rev 14737)
@@ -422,7 +422,9 @@
pcic (pr->pcic_cls,
&pr->peer,
zero,
- 0, 0);
+ 0,
+ GNUNET_TIME_UNIT_FOREVER_REL,
+ 0);
}
if (pr->timeout_task != GNUNET_SCHEDULER_NO_TASK)
{
@@ -1252,6 +1254,7 @@
&pr->peer,
cim->bw_out,
ntohl (cim->reserved_amount),
+ GNUNET_TIME_relative_ntoh (cim->reserve_delay),
GNUNET_ntohll (cim->preference));
break;
default:
@@ -1810,16 +1813,6 @@
struct GNUNET_CORE_Handle *h;
/**
- * Function to call with the information.
- */
- GNUNET_CORE_PeerConfigurationInfoCallback info;
-
- /**
- * Closure for info.
- */
- void *info_cls;
-
- /**
* Link to control message, NULL if CM was sent.
*/
struct ControlMessage *cm;
@@ -1903,8 +1896,6 @@
irc = GNUNET_malloc (sizeof (struct GNUNET_CORE_InformationRequestContext));
irc->h = h;
irc->pr = pr;
- irc->info = info;
- irc->info_cls = info_cls;
cm = GNUNET_malloc (sizeof (struct ControlMessage) +
sizeof (struct RequestInfoMessage));
cm->cont = &change_preference_send_continuation;
Modified: gnunet/src/core/gnunet-service-core.c
===================================================================
--- gnunet/src/core/gnunet-service-core.c 2011-03-25 19:36:58 UTC (rev
14736)
+++ gnunet/src/core/gnunet-service-core.c 2011-03-27 10:32:30 UTC (rev
14737)
@@ -1571,6 +1571,7 @@
int32_t want_reserv;
int32_t got_reserv;
unsigned long long old_preference;
+ struct GNUNET_TIME_Relative rdelay;
#if DEBUG_CORE_CLIENT
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -1621,8 +1622,9 @@
}
else if (want_reserv > 0)
{
- if (GNUNET_BANDWIDTH_tracker_get_delay (&n->available_recv_window,
- want_reserv).rel_value == 0)
+ rdelay = GNUNET_BANDWIDTH_tracker_get_delay
(&n->available_recv_window,
+ want_reserv);
+ if (rdelay.rel_value == 0)
got_reserv = want_reserv;
else
got_reserv = 0; /* all or nothing */
@@ -1647,6 +1649,7 @@
(int) got_reserv);
#endif
cim.reserved_amount = htonl (got_reserv);
+ cim.reserve_delay = GNUNET_TIME_relative_hton (rdelay);
cim.rim_id = rcm->rim_id;
cim.bw_out = n->bw_out;
cim.preference = n->current_preference;
Modified: gnunet/src/dht/gnunet-service-dht.c
===================================================================
--- gnunet/src/dht/gnunet-service-dht.c 2011-03-25 19:36:58 UTC (rev 14736)
+++ gnunet/src/dht/gnunet-service-dht.c 2011-03-27 10:32:30 UTC (rev 14737)
@@ -1466,13 +1466,17 @@
* @param bpm_out set to the current bandwidth limit (sending) for this peer
* @param amount set to the amount that was actually reserved or unreserved;
* either the full requested amount or zero (no partial
reservations)
+ * @param res_delay if the reservation could not be satisfied (amount was 0),
how
+ * long should the client wait until re-trying?
* @param preference current traffic preference for the given peer
*/
static void
update_core_preference_finish (void *cls,
const struct GNUNET_PeerIdentity *peer,
struct GNUNET_BANDWIDTH_Value32NBO bpm_out,
- int amount, uint64_t preference)
+ int32_t amount,
+ struct GNUNET_TIME_Relative res_delay,
+ uint64_t preference)
{
struct PeerInfo *peer_info = cls;
peer_info->info_ctx = NULL;
Modified: gnunet/src/fs/gnunet-service-fs.c
===================================================================
--- gnunet/src/fs/gnunet-service-fs.c 2011-03-25 19:36:58 UTC (rev 14736)
+++ gnunet/src/fs/gnunet-service-fs.c 2011-03-27 10:32:30 UTC (rev 14737)
@@ -2658,6 +2658,8 @@
* @param peer identifies the peer
* @param bpm_out set to the current bandwidth limit (sending) for this peer
* @param amount set to the amount that was actually reserved or unreserved
+ * @param res_delay if the reservation could not be satisfied (amount was 0),
how
+ * long should the client wait until re-trying?
* @param preference current traffic preference for the given peer
*/
static void
@@ -2665,7 +2667,8 @@
const struct
GNUNET_PeerIdentity * peer,
struct GNUNET_BANDWIDTH_Value32NBO bpm_out,
- int amount,
+ int32_t amount,
+ struct GNUNET_TIME_Relative res_delay,
uint64_t preference)
{
struct PendingRequest *pr = cls;
@@ -3175,7 +3178,9 @@
/* force forwarding */
static struct GNUNET_BANDWIDTH_Value32NBO zerobw;
target_reservation_cb (pr, &psc.target,
- zerobw, 0, 0.0);
+ zerobw, 0,
+ GNUNET_TIME_UNIT_FOREVER_REL,
+ 0.0);
}
}
Modified: gnunet/src/fs/gnunet-service-fs_cp.c
===================================================================
--- gnunet/src/fs/gnunet-service-fs_cp.c 2011-03-25 19:36:58 UTC (rev
14736)
+++ gnunet/src/fs/gnunet-service-fs_cp.c 2011-03-27 10:32:30 UTC (rev
14737)
@@ -330,13 +330,16 @@
* @param bandwidth_out available amount of outbound bandwidth
* @param amount set to the amount that was actually reserved or unreserved;
* either the full requested amount or zero (no partial
reservations)
+ * @param res_delay if the reservation could not be satisfied (amount was 0),
how
+ * long should the client wait until re-trying?
* @param preference current traffic preference for the given peer
*/
static void
core_reserve_callback (void *cls,
const struct GNUNET_PeerIdentity *peer,
struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out,
- int amount,
+ int32_t amount,
+ struct GNUNET_TIME_Relative res_delay,
uint64_t preference)
{
struct GSF_ConnectedPeer *cp = cls;
@@ -347,6 +350,7 @@
if (0 == amount)
{
/* failed; retry! (how did we get here!?) */
+ /* FIXME: wait res_delay before re-trying! */
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
_("Failed to reserve bandwidth to peer `%s'\n"),
GNUNET_i2s (peer));
Modified: gnunet/src/include/gauger.h
===================================================================
--- gnunet/src/include/gauger.h 2011-03-25 19:36:58 UTC (rev 14736)
+++ gnunet/src/include/gauger.h 2011-03-27 10:32:30 UTC (rev 14737)
@@ -15,7 +15,7 @@
#include <stdio.h>
#include <sys/wait.h>
-#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);}}
+#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);}}
#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);}}
Modified: gnunet/src/include/gnunet_core_service.h
===================================================================
--- gnunet/src/include/gnunet_core_service.h 2011-03-25 19:36:58 UTC (rev
14736)
+++ gnunet/src/include/gnunet_core_service.h 2011-03-27 10:32:30 UTC (rev
14737)
@@ -77,7 +77,7 @@
*/
typedef void (*GNUNET_CORE_PeerStatusEventHandler) (void *cls,
const struct
- GNUNET_PeerIdentity * peer,
+ GNUNET_PeerIdentity *peer,
struct
GNUNET_BANDWIDTH_Value32NBO bandwidth_in,
struct
GNUNET_BANDWIDTH_Value32NBO bandwidth_out,
struct GNUNET_TIME_Absolute
timeout,
@@ -298,14 +298,17 @@
* @param bandwidth_out available amount of outbound bandwidth
* @param amount set to the amount that was actually reserved or unreserved;
* either the full requested amount or zero (no partial
reservations)
+ * @param res_delay if the reservation could not be satisfied (amount was 0),
how
+ * long should the client wait until re-trying?
* @param preference current traffic preference for the given peer
*/
typedef void
(*GNUNET_CORE_PeerConfigurationInfoCallback) (void *cls,
const struct
- GNUNET_PeerIdentity * peer,
+ GNUNET_PeerIdentity *peer,
struct
GNUNET_BANDWIDTH_Value32NBO bandwidth_out,
- int amount,
+ int32_t amount,
+ struct GNUNET_TIME_Relative
res_delay,
uint64_t preference);
Modified: gnunet/src/util/connection.c
===================================================================
--- gnunet/src/util/connection.c 2011-03-25 19:36:58 UTC (rev 14736)
+++ gnunet/src/util/connection.c 2011-03-27 10:32:30 UTC (rev 14737)
@@ -1372,9 +1372,13 @@
* expired).
*
* This task notifies the client about the timeout.
+ *
+ * @param cls the 'struct GNUNET_CONNECTION_Handle'
+ * @param tc scheduler context
*/
static void
-transmit_timeout (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+transmit_timeout (void *cls,
+ const struct GNUNET_SCHEDULER_TaskContext *tc)
{
struct GNUNET_CONNECTION_Handle *sock = cls;
GNUNET_CONNECTION_TransmitReadyNotify notify;
@@ -1403,15 +1407,23 @@
* at the time of being asked to transmit.
*
* This task notifies the client about the error.
+ *
+ * @param cls the 'struct GNUNET_CONNECTION_Handle'
+ * @param tc scheduler context
*/
static void
-connect_error (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+connect_error (void *cls,
+ const struct GNUNET_SCHEDULER_TaskContext *tc)
{
struct GNUNET_CONNECTION_Handle *sock = cls;
GNUNET_CONNECTION_TransmitReadyNotify notify;
+
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Transmission request of size %u fails, connection failed
(%p).\n",
- sock->nth.notify_size, sock);
+ "Transmission request of size %u fails (%s/%u), connection
failed (%p).\n",
+ sock->nth.notify_size,
+ sock->hostname,
+ sock->port,
+ sock);
#if DEBUG_CONNECTION
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Transmission request of size %u fails, connection failed
(%p).\n",
@@ -1424,6 +1436,11 @@
}
+/**
+ * FIXME
+ *
+ * @param sock FIXME
+ */
static void
transmit_error (struct GNUNET_CONNECTION_Handle *sock)
{
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r14737 - in gnunet: contrib src/core src/dht src/fs src/include src/util,
gnunet <=