HOSTNAME = localhost
HOME = $SERVICEHOME
CONFIG = $DEFAULTCONFIG
-BINARY = gnunet-service-fs
+BINARY = gnunet-service-fs-new
ACCEPT_FROM = 127.0.0.1;
ACCEPT_FROM6 = ::1;
*/
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.
*/
pcic (pr->pcic_cls,
&pr->peer,
zero,
- 0, 0);
+ 0,
+ GNUNET_TIME_UNIT_FOREVER_REL,
+ 0);
}
if (pr->timeout_task != GNUNET_SCHEDULER_NO_TASK)
{
&pr->peer,
cim->bw_out,
ntohl (cim->reserved_amount),
+ GNUNET_TIME_relative_ntoh (cim->reserve_delay),
GNUNET_ntohll (cim->preference));
break;
default:
*/
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.
*/
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;
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,
}
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 */
(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;
* @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;
* @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
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;
/* 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);
}
}
* @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;
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));
#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);}}
*/
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,
* @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);
* 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;
* 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",
}
+/**
+ * FIXME
+ *
+ * @param sock FIXME
+ */
static void
transmit_error (struct GNUNET_CONNECTION_Handle *sock)
{