GNUnet  0.10.x
Data Structures | Macros | Functions | Variables
gnunet-service-fs_pe.c File Reference

API to manage query plan. More...

#include "platform.h"
#include "gnunet-service-fs.h"
#include "gnunet-service-fs_cp.h"
#include "gnunet-service-fs_pe.h"
#include "gnunet-service-fs_pr.h"
Include dependency graph for gnunet-service-fs_pe.c:

Go to the source code of this file.

Data Structures

struct  GSF_PendingRequestPlanBijection
 M:N binding of plans to pending requests. More...
 
struct  GSF_RequestPlan
 Information we keep per request per peer. More...
 
struct  PeerPlan
 Transmission plan for a peer. More...
 
struct  MergeContext
 Closure for merge_pr(). More...
 

Macros

#define INSANE_STATISTICS   GNUNET_NO
 Collect an instane number of statistics? May cause excessive IPC. More...
 
#define N   ((double)128.0)
 

Functions

static const struct GNUNET_HashCodeget_rp_key (struct GSF_RequestPlan *rp)
 Return the query (key in the plan_map) for the given request plan. More...
 
static void plan (struct PeerPlan *pp, struct GSF_RequestPlan *rp)
 Insert the given request plan into the heap with the appropriate weight. More...
 
struct GSF_PendingRequestget_latest (const struct GSF_RequestPlan *rp)
 Get the pending request with the highest TTL from the given plan. More...
 
static void schedule_peer_transmission (void *cls)
 Figure out when and how to transmit to the given peer. More...
 
static int merge_pr (void *cls, const struct GNUNET_HashCode *query, void *element)
 Iterator that checks if an equivalent request is already present for this peer. More...
 
void GSF_plan_add_ (struct GSF_ConnectedPeer *cp, struct GSF_PendingRequest *pr)
 Create a new query plan entry. More...
 
void GSF_plan_notify_peer_disconnect_ (const struct GSF_ConnectedPeer *cp)
 Notify the plan about a peer being no longer available; destroy all entries associated with this peer. More...
 
int GSF_request_plan_reference_get_last_transmission_ (struct GSF_PendingRequestPlanBijection *pr_head, struct GSF_ConnectedPeer *sender, struct GNUNET_TIME_Absolute *result)
 Get the last transmission attempt time for the request plan list referenced by pr_head, that was sent to sender. More...
 
void GSF_plan_notify_request_done_ (struct GSF_PendingRequest *pr)
 Notify the plan about a request being done; destroy all entries associated with this request. More...
 
void GSF_plan_init ()
 Initialize plan subsystem. More...
 
void GSF_plan_done ()
 Shutdown plan subsystem. More...
 

Variables

static struct GNUNET_CONTAINER_MultiPeerMapplans
 Hash map from peer identities to PeerPlans. More...
 
static unsigned long long total_delay
 Sum of all transmission counters (equals total delay for all plan entries). More...
 
static unsigned long long plan_count
 Number of plan entries. More...
 

Detailed Description

API to manage query plan.

Author
Christian Grothoff

Definition in file gnunet-service-fs_pe.c.

Macro Definition Documentation

◆ INSANE_STATISTICS

#define INSANE_STATISTICS   GNUNET_NO

Collect an instane number of statistics? May cause excessive IPC.

Definition at line 35 of file gnunet-service-fs_pe.c.

◆ N

#define N   ((double)128.0)

Referenced by plan().

Function Documentation

◆ get_rp_key()

static const struct GNUNET_HashCode* get_rp_key ( struct GSF_RequestPlan rp)
static

Return the query (key in the plan_map) for the given request plan.

Note that this key may change as there can be multiple pending requests for the same key and we just return one of them; this particular one might complete while another one might still be active, hence the lifetime of the returned hash code is NOT necessarily identical to that of the struct GSF_RequestPlan given.

Parameters
rpa request plan
Returns
the associated query

Definition at line 238 of file gnunet-service-fs_pe.c.

References GSF_pending_request_get_data_(), GSF_RequestPlan::pe_head, GSF_PendingRequestPlanBijection::pr, and GSF_PendingRequestData::query.

Referenced by GSF_plan_add_(), GSF_plan_notify_peer_disconnect_(), and plan().

239 {
241 }
struct GNUNET_HashCode query
Primary query hash for this request.
struct GSF_PendingRequestPlanBijection * pe_head
Head of list of associated pending requests.
struct GSF_PendingRequest * pr
Associated pending request (identifies request details and one of the origins of the request)...
struct GSF_PendingRequestData * GSF_pending_request_get_data_(struct GSF_PendingRequest *pr)
Obtain the public data associated with a pending request.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ plan()

static void plan ( struct PeerPlan pp,
struct GSF_RequestPlan rp 
)
static

Insert the given request plan into the heap with the appropriate weight.

Parameters
ppassociated peer's plan
rprequest to plan

Running average delay we currently impose.

Definition at line 251 of file gnunet-service-fs_pe.c.

References GNUNET_TIME_Absolute::abs_value_us, PeerPlan::delay_heap, GSF_RequestPlan::earliest_transmission, get_rp_key(), gettext_noop, GNUNET_assert, GNUNET_CONTAINER_heap_insert(), GNUNET_CONTAINER_multihashmap_contains_value(), GNUNET_CRYPTO_QUALITY_WEAK, GNUNET_CRYPTO_random_u32(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_h2s(), GNUNET_log, GNUNET_NO, GNUNET_STATISTICS_set(), GNUNET_STRINGS_relative_time_to_string(), GNUNET_TIME_absolute_get_remaining(), GNUNET_TIME_relative_multiply(), GNUNET_TIME_relative_to_absolute(), GNUNET_TIME_UNIT_SECONDS, GNUNET_YES, GSF_current_priorities, GSF_pending_request_get_data_(), GSF_stats, GSF_RequestPlan::hn, N, GSF_RequestPlan::pe_head, plan_count, PeerPlan::plan_map, GSF_RequestPlan::pp, GSF_PendingRequestPlanBijection::pr, GSF_RequestPlan::priority, PeerPlan::priority_heap, GSF_PendingRequestData::query, GNUNET_TIME_Relative::rel_value_us, total_delay, GSF_RequestPlan::transmission_counter, and TTL_DECREMENT.

Referenced by GSF_plan_add_(), and schedule_peer_transmission().

253 {
254 #define N ((double)128.0)
255 
258  static double avg_delay;
259 
260  struct GSF_PendingRequestData *prd;
262 
263  GNUNET_assert (rp->pp == pp);
265  gettext_noop ("# average retransmission delay (ms)"),
266  total_delay * 1000LL / plan_count, GNUNET_NO);
268 
269  if (rp->transmission_counter < 8)
270  delay =
273  else if (rp->transmission_counter < 32)
274  delay =
276  8 +
277  (1LL << (rp->transmission_counter - 8)));
278  else
279  delay =
281  8 + (1LL << 24));
284  delay.rel_value_us + 1);
285  /* Add 0.01 to avg_delay to avoid division-by-zero later */
286  avg_delay = (((avg_delay * (N - 1.0)) + delay.rel_value_us) / N) + 0.01;
287 
288  /*
289  * For the priority, we need to consider a few basic rules:
290  * 1) if we just started requesting (delay is small), we should
291  * virtually always have a priority of zero.
292  * 2) for requests with average latency, our priority should match
293  * the average priority observed on the network
294  * 3) even the longest-running requests should not be WAY out of
295  * the observed average (thus we bound by a factor of 2)
296  * 4) we add +1 to the observed average priority to avoid everyone
297  * staying put at zero (2 * 0 = 0...).
298  *
299  * Using the specific calculation below, we get:
300  *
301  * delay = 0 => priority = 0;
302  * delay = avg delay => priority = running-average-observed-priority;
303  * delay >> avg_delay => priority = 2 * running-average-observed-priority;
304  *
305  * which satisfies all of the rules above.
306  *
307  * Note: M_PI_4 = PI/4 = arctan(1)
308  */
309  rp->priority =
310  round ((GSF_current_priorities +
311  1.0) * atan (delay.rel_value_us / avg_delay)) / M_PI_4;
312  /* Note: usage of 'round' and 'atan' requires -lm */
313 
314  if (rp->transmission_counter != 0)
315  delay.rel_value_us += TTL_DECREMENT * 1000;
317  "Considering (re)transmission number %u in %s\n",
318  (unsigned int) rp->transmission_counter,
320  GNUNET_YES));
323  "Earliest (re)transmission for `%s' in %us\n",
324  GNUNET_h2s (&prd->query),
326  GNUNET_assert (rp->hn == NULL);
329  rp,
330  rp->priority);
331  else
332  rp->hn =
334  rp,
338  get_rp_key (rp),
339  rp));
340 #undef N
341 }
uint64_t rel_value_us
The actual value.
static unsigned long long total_delay
Sum of all transmission counters (equals total delay for all plan entries).
struct GNUNET_CONTAINER_MultiHashMap * plan_map
Map of queries to plan entries.
struct GNUNET_CONTAINER_HeapNode * GNUNET_CONTAINER_heap_insert(struct GNUNET_CONTAINER_Heap *heap, void *element, GNUNET_CONTAINER_HeapCostType cost)
Inserts a new element into the heap.
double GSF_current_priorities
Typical priorities we&#39;re seeing from other peers right now.
struct GNUNET_TIME_Absolute GNUNET_TIME_relative_to_absolute(struct GNUNET_TIME_Relative rel)
Convert relative time to an absolute time in the future.
Definition: time.c:245
uint32_t GNUNET_CRYPTO_random_u32(enum GNUNET_CRYPTO_Quality mode, uint32_t i)
Produce a random value.
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
#define GNUNET_TIME_UNIT_SECONDS
One second.
static unsigned long long plan_count
Number of plan entries.
struct GNUNET_STATISTICS_Handle * GSF_stats
Handle for reporting statistics.
#define GNUNET_NO
Definition: gnunet_common.h:81
const char * GNUNET_h2s(const struct GNUNET_HashCode *hc)
Convert a hash value to a string (for printing debug messages).
static const struct GNUNET_HashCode * get_rp_key(struct GSF_RequestPlan *rp)
Return the query (key in the plan_map) for the given request plan.
#define N
uint64_t abs_value_us
The actual value.
struct GNUNET_HashCode query
Primary query hash for this request.
struct GSF_PendingRequestPlanBijection * pe_head
Head of list of associated pending requests.
struct GNUNET_CONTAINER_Heap * delay_heap
Heap with pending queries (struct GSF_RequestPlan), by transmission time, lowest first.
Public data (in the sense of not encapsulated within &#39;gnunet-service-fs_pr&#39;, not in the sense of netw...
struct GNUNET_TIME_Absolute earliest_transmission
Earliest time we&#39;d be happy to (re)transmit this request.
struct PeerPlan * pp
The transmission plan for a peer that this request is associated with.
unsigned int transmission_counter
How often did we transmit this request to this peer?
const char * GNUNET_STRINGS_relative_time_to_string(struct GNUNET_TIME_Relative delta, int do_round)
Give relative time in human-readable fancy format.
Definition: strings.c:727
struct GNUNET_TIME_Relative GNUNET_TIME_relative_multiply(struct GNUNET_TIME_Relative rel, unsigned long long factor)
Multiply relative time by a given factor.
Definition: time.c:439
void GNUNET_STATISTICS_set(struct GNUNET_STATISTICS_Handle *handle, const char *name, uint64_t value, int make_persistent)
Set statistic value for the peer.
struct GSF_PendingRequest * pr
Associated pending request (identifies request details and one of the origins of the request)...
struct GNUNET_CONTAINER_HeapNode * hn
Heap node associated with this request and this peer.
int GNUNET_CONTAINER_multihashmap_contains_value(const struct GNUNET_CONTAINER_MultiHashMap *map, const struct GNUNET_HashCode *key, const void *value)
Check if the map contains the given value under the given key.
static struct GNUNET_TIME_Relative delay
When should dkg communication start?
struct GSF_PendingRequestData * GSF_pending_request_get_data_(struct GSF_PendingRequest *pr)
Obtain the public data associated with a pending request.
#define GNUNET_log(kind,...)
#define TTL_DECREMENT
By which amount do we decrement the TTL for simple forwarding / indirection of the query; in milli-se...
struct GNUNET_TIME_Relative GNUNET_TIME_absolute_get_remaining(struct GNUNET_TIME_Absolute future)
Given a timestamp in the future, how much time remains until then?
Definition: time.c:331
#define GNUNET_YES
Definition: gnunet_common.h:80
uint64_t priority
Current priority for this request for this target.
No good quality of the operation is needed (i.e., random numbers can be pseudo-random).
Time for relative time used by GNUnet, in microseconds.
#define gettext_noop(String)
Definition: gettext.h:69
struct GNUNET_CONTAINER_Heap * priority_heap
Heap with pending queries (struct GSF_RequestPlan), higher weights mean higher priority.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_latest()

struct GSF_PendingRequest* get_latest ( const struct GSF_RequestPlan rp)

Get the pending request with the highest TTL from the given plan.

Parameters
rpplan to investigate
Returns
pending request with highest TTL

Definition at line 351 of file gnunet-service-fs_pe.c.

References GNUNET_TIME_Absolute::abs_value_us, GNUNET_break, GNUNET_YES, GSF_pending_request_get_data_(), GSF_pending_request_test_active_(), GSF_PendingRequestPlanBijection::next_PE, GSF_RequestPlan::pe_head, GSF_PendingRequestPlanBijection::pr, ret, and GSF_PendingRequestData::ttl.

Referenced by merge_pr(), and schedule_peer_transmission().

352 {
353  struct GSF_PendingRequest *ret;
355  const struct GSF_PendingRequestData *rprd;
356  const struct GSF_PendingRequestData *prd;
357 
358  bi = rp->pe_head;
359  if (NULL == bi)
360  return NULL; /* should never happen */
361  ret = bi->pr;
362  rprd = GSF_pending_request_get_data_ (ret);
363  for (bi = bi->next_PE; NULL != bi; bi = bi->next_PE)
364  {
367  prd = GSF_pending_request_get_data_ (bi->pr);
368  if (prd->ttl.abs_value_us > rprd->ttl.abs_value_us)
369  {
370  ret = bi->pr;
371  rprd = prd;
372  }
373  }
374  return ret;
375 }
struct GSF_PendingRequestPlanBijection * next_PE
This is a doubly-linked list.
struct GNUNET_TIME_Absolute ttl
Current TTL for the request.
static int ret
Final status code.
Definition: gnunet-arm.c:89
uint64_t abs_value_us
The actual value.
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur...
struct GSF_PendingRequestPlanBijection * pe_head
Head of list of associated pending requests.
Public data (in the sense of not encapsulated within &#39;gnunet-service-fs_pr&#39;, not in the sense of netw...
int GSF_pending_request_test_active_(struct GSF_PendingRequest *pr)
Check if the given request is still active.
struct GSF_PendingRequest * pr
Associated pending request (identifies request details and one of the origins of the request)...
struct GSF_PendingRequestData * GSF_pending_request_get_data_(struct GSF_PendingRequest *pr)
Obtain the public data associated with a pending request.
#define GNUNET_YES
Definition: gnunet_common.h:80
An active request.
M:N binding of plans to pending requests.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ schedule_peer_transmission()

static void schedule_peer_transmission ( void *  cls)
static

Figure out when and how to transmit to the given peer.

Parameters
clsthe struct PeerPlan

Definition at line 384 of file gnunet-service-fs_pe.c.

References PeerPlan::cp, PeerPlan::delay_heap, GSF_RequestPlan::earliest_transmission, PeerPlan::env, get_latest(), gettext_noop, GNUNET_assert, GNUNET_CONTAINER_heap_get_size(), GNUNET_CONTAINER_heap_insert(), GNUNET_CONTAINER_heap_peek(), GNUNET_CONTAINER_heap_remove_root(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_log, GNUNET_MQ_notify_sent(), GNUNET_NO, GNUNET_SCHEDULER_add_at(), GNUNET_STATISTICS_set(), GNUNET_STATISTICS_update(), GNUNET_STRINGS_relative_time_to_string(), GNUNET_TIME_absolute_get(), GNUNET_TIME_absolute_get_remaining(), GNUNET_YES, GSF_peer_transmit_(), GSF_pending_request_get_message_(), GSF_stats, GSF_RequestPlan::hn, GSF_RequestPlan::last_transmission, plan(), GSF_RequestPlan::priority, PeerPlan::priority_heap, GNUNET_TIME_Relative::rel_value_us, GSF_PendingRequestPlanBijection::rp, PeerPlan::task, total_delay, and GSF_RequestPlan::transmission_counter.

Referenced by GSF_plan_add_().

385 {
386  struct PeerPlan *pp = cls;
387  struct GSF_RequestPlan *rp;
389 
390  if (NULL != pp->task)
391  {
392  pp->task = NULL;
393  }
394  else
395  {
396  GNUNET_assert (NULL != pp->env);
397  pp->env = NULL;
398  }
399  /* move ready requests to priority queue */
400  while ((NULL != (rp = GNUNET_CONTAINER_heap_peek (pp->delay_heap))) &&
403  {
406  rp,
407  rp->priority);
408  }
410  {
411  /* priority heap (still) empty, check for delay... */
413  if (NULL == rp)
414  {
416  "No active requests for plan %p.\n",
417  pp);
418  return; /* both queues empty */
419  }
422  "Sleeping for %s before retrying requests on plan %p.\n",
424  GNUNET_YES),
425  pp);
427  gettext_noop ("# delay heap timeout (ms)"),
428  delay.rel_value_us / 1000LL, GNUNET_NO);
429 
430  pp->task
433  pp);
434  return;
435  }
436 #if INSANE_STATISTICS
438  gettext_noop ("# query plans executed"),
439  1,
440  GNUNET_NO);
441 #endif
442  /* process from priority heap */
445  "Executing query plan %p\n",
446  rp);
447  GNUNET_assert (NULL != rp);
448  rp->hn = NULL;
450  rp->transmission_counter++;
451  total_delay++;
453  "Executing plan %p executed %u times, planning retransmission\n",
454  rp,
456  GNUNET_assert (NULL == pp->env);
460  pp);
461  GSF_peer_transmit_ (pp->cp,
462  GNUNET_YES,
463  rp->priority,
464  pp->env);
466  gettext_noop ("# query messages sent to other peers"),
467  1,
468  GNUNET_NO);
469  plan (pp,
470  rp);
471 }
uint64_t rel_value_us
The actual value.
static unsigned long long total_delay
Sum of all transmission counters (equals total delay for all plan entries).
struct GNUNET_CONTAINER_HeapNode * GNUNET_CONTAINER_heap_insert(struct GNUNET_CONTAINER_Heap *heap, void *element, GNUNET_CONTAINER_HeapCostType cost)
Inserts a new element into the heap.
Transmission plan for a peer.
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
void GSF_peer_transmit_(struct GSF_ConnectedPeer *cp, int is_query, uint32_t priority, struct GNUNET_MQ_Envelope *env)
Transmit a message to the given peer as soon as possible.
struct GNUNET_MQ_Envelope * env
Current message under transmission for the plan.
struct GNUNET_STATISTICS_Handle * GSF_stats
Handle for reporting statistics.
#define GNUNET_NO
Definition: gnunet_common.h:81
void GNUNET_STATISTICS_update(struct GNUNET_STATISTICS_Handle *handle, const char *name, int64_t delta, int make_persistent)
Set statistic value for the peer.
struct GSF_ConnectedPeer * cp
Peer for which this is the plan.
struct GNUNET_CONTAINER_Heap * delay_heap
Heap with pending queries (struct GSF_RequestPlan), by transmission time, lowest first.
static void schedule_peer_transmission(void *cls)
Figure out when and how to transmit to the given peer.
struct GNUNET_TIME_Absolute earliest_transmission
Earliest time we&#39;d be happy to (re)transmit this request.
void GNUNET_MQ_notify_sent(struct GNUNET_MQ_Envelope *ev, GNUNET_SCHEDULER_TaskCallback cb, void *cb_cls)
Call a callback once the envelope has been sent, that is, sending it can not be canceled anymore...
Definition: mq.c:774
unsigned int transmission_counter
How often did we transmit this request to this peer?
void * GNUNET_CONTAINER_heap_peek(const struct GNUNET_CONTAINER_Heap *heap)
Get element stored at the root of heap.
const char * GNUNET_STRINGS_relative_time_to_string(struct GNUNET_TIME_Relative delta, int do_round)
Give relative time in human-readable fancy format.
Definition: strings.c:727
static void plan(struct PeerPlan *pp, struct GSF_RequestPlan *rp)
Insert the given request plan into the heap with the appropriate weight.
void GNUNET_STATISTICS_set(struct GNUNET_STATISTICS_Handle *handle, const char *name, uint64_t value, int make_persistent)
Set statistic value for the peer.
struct GNUNET_TIME_Absolute GNUNET_TIME_absolute_get(void)
Get the current time.
Definition: time.c:118
unsigned int GNUNET_CONTAINER_heap_get_size(const struct GNUNET_CONTAINER_Heap *heap)
Get the current size of the heap.
struct GNUNET_CONTAINER_HeapNode * hn
Heap node associated with this request and this peer.
struct GNUNET_TIME_Absolute last_transmission
When was the last time we transmitted this request to this peer? 0 for never.
Information we keep per request per peer.
static struct GNUNET_TIME_Relative delay
When should dkg communication start?
struct GNUNET_MQ_Envelope * GSF_pending_request_get_message_(struct GSF_PendingRequest *pr)
Generate the message corresponding to the given pending request for transmission to other peers...
#define GNUNET_log(kind,...)
void * GNUNET_CONTAINER_heap_remove_root(struct GNUNET_CONTAINER_Heap *heap)
Remove root of the heap.
static char * rp
Relying party.
struct GNUNET_TIME_Relative GNUNET_TIME_absolute_get_remaining(struct GNUNET_TIME_Absolute future)
Given a timestamp in the future, how much time remains until then?
Definition: time.c:331
#define GNUNET_YES
Definition: gnunet_common.h:80
struct GNUNET_SCHEDULER_Task * task
Current task for executing the plan.
uint64_t priority
Current priority for this request for this target.
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_at(struct GNUNET_TIME_Absolute at, GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run at the specified time.
Definition: scheduler.c:1223
struct GSF_PendingRequest * get_latest(const struct GSF_RequestPlan *rp)
Get the pending request with the highest TTL from the given plan.
Time for relative time used by GNUnet, in microseconds.
#define gettext_noop(String)
Definition: gettext.h:69
struct GNUNET_CONTAINER_Heap * priority_heap
Heap with pending queries (struct GSF_RequestPlan), higher weights mean higher priority.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ merge_pr()

static int merge_pr ( void *  cls,
const struct GNUNET_HashCode query,
void *  element 
)
static

Iterator that checks if an equivalent request is already present for this peer.

Parameters
clsclosure
querythe query
elementrequest plan stored at the node
Returns
GNUNET_YES if we should continue to iterate, GNUNET_NO if not (merge success)

Definition at line 504 of file gnunet-service-fs_pe.c.

References GNUNET_TIME_Absolute::abs_value_us, get_latest(), gettext_noop, GNUNET_break, GNUNET_CONTAINER_MDLL_insert, GNUNET_new, GNUNET_NO, GNUNET_OK, GNUNET_STATISTICS_update(), GNUNET_YES, GSF_pending_request_get_data_(), GSF_pending_request_is_compatible_(), GSF_pending_request_test_active_(), GSF_stats, MergeContext::merged, GSF_RequestPlan::pe_head, GSF_RequestPlan::pe_tail, GSF_PendingRequestPlanBijection::pr, MergeContext::pr, GSF_PendingRequestData::pr_head, GSF_PendingRequestData::pr_tail, GSF_PendingRequestPlanBijection::rp, GSF_RequestPlan::transmission_counter, and GSF_PendingRequestData::ttl.

Referenced by GSF_plan_add_().

507 {
508  struct MergeContext *mpr = cls;
509  struct GSF_RequestPlan *rp = element;
510  struct GSF_PendingRequestData *prd;
512  struct GSF_PendingRequest *latest;
513 
516  if (GNUNET_OK !=
518  rp->pe_head->pr))
519  return GNUNET_YES;
520  /* merge new request with existing request plan */
522  bi->rp = rp;
523  bi->pr = mpr->pr;
524  prd = GSF_pending_request_get_data_ (mpr->pr);
526  prd->pr_head,
527  prd->pr_tail,
528  bi);
530  rp->pe_head,
531  rp->pe_tail,
532  bi);
533  mpr->merged = GNUNET_YES;
534 #if INSANE_STATISTICS
536  gettext_noop ("# requests merged"),
537  1,
538  GNUNET_NO);
539 #endif
540  latest = get_latest (rp);
541  if (GSF_pending_request_get_data_ (latest)->ttl.abs_value_us <
542  prd->ttl.abs_value_us)
543  {
544 #if INSANE_STATISTICS
546  gettext_noop ("# requests refreshed"),
547  1,
548  GNUNET_NO);
549 #endif
550  rp->transmission_counter = 0; /* reset */
551  }
552  return GNUNET_NO;
553 }
Closure for merge_pr().
struct GNUNET_TIME_Absolute ttl
Current TTL for the request.
struct GSF_PendingRequestPlanBijection * pr_head
Fields for the plan module to track a DLL with the request.
struct GNUNET_STATISTICS_Handle * GSF_stats
Handle for reporting statistics.
#define GNUNET_NO
Definition: gnunet_common.h:81
#define GNUNET_OK
Named constants for return values.
Definition: gnunet_common.h:78
#define GNUNET_new(type)
Allocate a struct or union of the given type.
int GSF_pending_request_is_compatible_(struct GSF_PendingRequest *pra, struct GSF_PendingRequest *prb)
Test if two pending requests are compatible (would generate the same query modulo filters and should ...
void GNUNET_STATISTICS_update(struct GNUNET_STATISTICS_Handle *handle, const char *name, int64_t delta, int make_persistent)
Set statistic value for the peer.
uint64_t abs_value_us
The actual value.
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur...
struct GSF_RequestPlan * rp
Associated request plan (tells us one of the peers that we plan to forward the request to)...
struct GSF_PendingRequestPlanBijection * pe_head
Head of list of associated pending requests.
struct GSF_PendingRequestPlanBijection * pe_tail
Tail of list of associated pending requests.
Public data (in the sense of not encapsulated within &#39;gnunet-service-fs_pr&#39;, not in the sense of netw...
int merged
Set to GNUNET_YES if we succeeded to merge.
#define GNUNET_CONTAINER_MDLL_insert(mdll, head, tail, element)
Insert an element at the head of a MDLL.
unsigned int transmission_counter
How often did we transmit this request to this peer?
int GSF_pending_request_test_active_(struct GSF_PendingRequest *pr)
Check if the given request is still active.
struct GSF_PendingRequest * pr
Associated pending request (identifies request details and one of the origins of the request)...
struct GSF_PendingRequestPlanBijection * pr_tail
Fields for the plan module to track a DLL with the request.
Information we keep per request per peer.
struct GSF_PendingRequestData * GSF_pending_request_get_data_(struct GSF_PendingRequest *pr)
Obtain the public data associated with a pending request.
struct GSF_PendingRequest * pr
Request we are trying to merge.
static char * rp
Relying party.
#define GNUNET_YES
Definition: gnunet_common.h:80
An active request.
struct GSF_PendingRequest * get_latest(const struct GSF_RequestPlan *rp)
Get the pending request with the highest TTL from the given plan.
M:N binding of plans to pending requests.
#define gettext_noop(String)
Definition: gettext.h:69
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GSF_plan_add_()

void GSF_plan_add_ ( struct GSF_ConnectedPeer cp,
struct GSF_PendingRequest pr 
)

Create a new query plan entry.

Parameters
cppeer with the entry
prrequest with the entry

Definition at line 563 of file gnunet-service-fs_pe.c.

References PeerPlan::cp, PeerPlan::delay_heap, get_rp_key(), gettext_noop, GNUNET_assert, GNUNET_CONTAINER_heap_create(), GNUNET_CONTAINER_HEAP_ORDER_MAX, GNUNET_CONTAINER_HEAP_ORDER_MIN, GNUNET_CONTAINER_MDLL_insert, GNUNET_CONTAINER_multihashmap_create(), GNUNET_CONTAINER_multihashmap_get_multiple(), GNUNET_CONTAINER_multihashmap_put(), GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE, GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY, GNUNET_CONTAINER_multipeermap_get(), GNUNET_CONTAINER_multipeermap_put(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_h2s(), GNUNET_i2s(), GNUNET_log, GNUNET_new, GNUNET_NO, GNUNET_OK, GNUNET_SCHEDULER_add_now(), GNUNET_STATISTICS_update(), GNUNET_YES, GSF_connected_peer_get_identity2_(), GSF_pending_request_get_data_(), GSF_pending_request_test_active_(), GSF_stats, id, merge_pr(), MergeContext::merged, GSF_RequestPlan::pe_head, GSF_RequestPlan::pe_tail, plan(), plan_count, PeerPlan::plan_map, GSF_RequestPlan::pp, GSF_PendingRequestPlanBijection::pr, MergeContext::pr, GSF_PendingRequestData::pr_head, GSF_PendingRequestData::pr_tail, PeerPlan::priority_heap, GSF_PendingRequestData::query, GSF_PendingRequestPlanBijection::rp, schedule_peer_transmission(), and PeerPlan::task.

Referenced by consider_peer_for_forwarding(), and consider_request_for_forwarding().

565 {
566  const struct GNUNET_PeerIdentity *id;
567  struct PeerPlan *pp;
568  struct GSF_PendingRequestData *prd;
569  struct GSF_RequestPlan *rp;
571  struct MergeContext mpc;
572 
575  GNUNET_assert (NULL != cp);
578  if (NULL == pp)
579  {
580  pp = GNUNET_new (struct PeerPlan);
582  pp->priority_heap =
584  pp->delay_heap =
586  pp->cp = cp;
589  id,
590  pp,
593  pp);
594  }
595  mpc.merged = GNUNET_NO;
596  mpc.pr = pr;
599  &prd->query,
600  &merge_pr,
601  &mpc);
602  if (GNUNET_NO != mpc.merged)
603  return;
604  plan_count++;
606  gettext_noop ("# query plan entries"),
607  1,
608  GNUNET_NO);
610  "Planning transmission of query `%s' to peer `%s'\n",
611  GNUNET_h2s (&prd->query),
612  GNUNET_i2s (id));
613  rp = GNUNET_new (struct GSF_RequestPlan);
615  bi->rp = rp;
616  bi->pr = pr;
618  prd->pr_head,
619  prd->pr_tail,
620  bi);
622  rp->pe_head,
623  rp->pe_tail,
624  bi);
625  rp->pp = pp;
628  get_rp_key (rp),
629  rp,
631  plan (pp,
632  rp);
633 }
Closure for merge_pr().
struct GNUNET_CONTAINER_MultiHashMap * plan_map
Map of queries to plan entries.
Transmission plan for a peer.
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
static unsigned long long plan_count
Number of plan entries.
struct GSF_PendingRequestPlanBijection * pr_head
Fields for the plan module to track a DLL with the request.
struct GNUNET_STATISTICS_Handle * GSF_stats
Handle for reporting statistics.
#define GNUNET_NO
Definition: gnunet_common.h:81
static struct GNUNET_IDENTITY_Handle * id
Handle to identity service.
const char * GNUNET_h2s(const struct GNUNET_HashCode *hc)
Convert a hash value to a string (for printing debug messages).
#define GNUNET_OK
Named constants for return values.
Definition: gnunet_common.h:78
#define GNUNET_new(type)
Allocate a struct or union of the given type.
void GNUNET_STATISTICS_update(struct GNUNET_STATISTICS_Handle *handle, const char *name, int64_t delta, int make_persistent)
Set statistic value for the peer.
static const struct GNUNET_HashCode * get_rp_key(struct GSF_RequestPlan *rp)
Return the query (key in the plan_map) for the given request plan.
struct GSF_ConnectedPeer * cp
Peer for which this is the plan.
struct GSF_RequestPlan * rp
Associated request plan (tells us one of the peers that we plan to forward the request to)...
struct GNUNET_HashCode query
Primary query hash for this request.
struct GSF_PendingRequestPlanBijection * pe_head
Head of list of associated pending requests.
struct GSF_PendingRequestPlanBijection * pe_tail
Tail of list of associated pending requests.
struct GNUNET_CONTAINER_Heap * delay_heap
Heap with pending queries (struct GSF_RequestPlan), by transmission time, lowest first.
Public data (in the sense of not encapsulated within &#39;gnunet-service-fs_pr&#39;, not in the sense of netw...
static void schedule_peer_transmission(void *cls)
Figure out when and how to transmit to the given peer.
#define GNUNET_CONTAINER_MDLL_insert(mdll, head, tail, element)
Insert an element at the head of a MDLL.
struct PeerPlan * pp
The transmission plan for a peer that this request is associated with.
int GSF_pending_request_test_active_(struct GSF_PendingRequest *pr)
Check if the given request is still active.
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_now(GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run as soon as possible.
Definition: scheduler.c:1273
static void plan(struct PeerPlan *pp, struct GSF_RequestPlan *rp)
Insert the given request plan into the heap with the appropriate weight.
Heap with the minimum cost at the root.
struct GSF_PendingRequest * pr
Associated pending request (identifies request details and one of the origins of the request)...
There must only be one value per key; storing a value should fail if a value under the same key alrea...
struct GSF_PendingRequestPlanBijection * pr_tail
Fields for the plan module to track a DLL with the request.
Information we keep per request per peer.
int GNUNET_CONTAINER_multihashmap_put(struct GNUNET_CONTAINER_MultiHashMap *map, const struct GNUNET_HashCode *key, void *value, enum GNUNET_CONTAINER_MultiHashMapOption opt)
Store a key-value pair in the map.
struct GNUNET_CONTAINER_Heap * GNUNET_CONTAINER_heap_create(enum GNUNET_CONTAINER_HeapOrder order)
Create a new heap.
Allow multiple values with the same key.
int GNUNET_CONTAINER_multipeermap_put(struct GNUNET_CONTAINER_MultiPeerMap *map, const struct GNUNET_PeerIdentity *key, void *value, enum GNUNET_CONTAINER_MultiHashMapOption opt)
Store a key-value pair in the map.
The identity of the host (wraps the signing key of the peer).
struct GSF_PendingRequestData * GSF_pending_request_get_data_(struct GSF_PendingRequest *pr)
Obtain the public data associated with a pending request.
int GNUNET_CONTAINER_multihashmap_get_multiple(struct GNUNET_CONTAINER_MultiHashMap *map, const struct GNUNET_HashCode *key, GNUNET_CONTAINER_MulitHashMapIteratorCallback it, void *it_cls)
Iterate over all entries in the map that match a particular key.
const struct GNUNET_PeerIdentity * GSF_connected_peer_get_identity2_(const struct GSF_ConnectedPeer *cp)
Obtain the identity of a connected peer.
void * GNUNET_CONTAINER_multipeermap_get(const struct GNUNET_CONTAINER_MultiPeerMap *map, const struct GNUNET_PeerIdentity *key)
Given a key find a value in the map matching the key.
Heap with the maximum cost at the root.
#define GNUNET_log(kind,...)
struct GSF_PendingRequest * pr
Request we are trying to merge.
struct GNUNET_CONTAINER_MultiHashMap * GNUNET_CONTAINER_multihashmap_create(unsigned int len, int do_not_copy_keys)
Create a multi hash map.
static char * rp
Relying party.
#define GNUNET_YES
Definition: gnunet_common.h:80
struct GNUNET_SCHEDULER_Task * task
Current task for executing the plan.
static int merge_pr(void *cls, const struct GNUNET_HashCode *query, void *element)
Iterator that checks if an equivalent request is already present for this peer.
static struct GNUNET_CONTAINER_MultiPeerMap * plans
Hash map from peer identities to PeerPlans.
const char * GNUNET_i2s(const struct GNUNET_PeerIdentity *pid)
Convert a peer identity to a string (for printing debug messages).
M:N binding of plans to pending requests.
#define gettext_noop(String)
Definition: gettext.h:69
struct GNUNET_CONTAINER_Heap * priority_heap
Heap with pending queries (struct GSF_RequestPlan), higher weights mean higher priority.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GSF_plan_notify_peer_disconnect_()

void GSF_plan_notify_peer_disconnect_ ( const struct GSF_ConnectedPeer cp)

Notify the plan about a peer being no longer available; destroy all entries associated with this peer.

Parameters
cpconnected peer

Definition at line 643 of file gnunet-service-fs_pe.c.

References PeerPlan::delay_heap, get_rp_key(), gettext_noop, GNUNET_assert, GNUNET_break, GNUNET_CONTAINER_heap_destroy(), GNUNET_CONTAINER_heap_remove_root(), GNUNET_CONTAINER_MDLL_remove, GNUNET_CONTAINER_multihashmap_destroy(), GNUNET_CONTAINER_multihashmap_remove(), GNUNET_CONTAINER_multipeermap_get(), GNUNET_CONTAINER_multipeermap_remove(), GNUNET_free, GNUNET_NO, GNUNET_SCHEDULER_cancel(), GNUNET_STATISTICS_set(), GNUNET_YES, GSF_connected_peer_get_identity2_(), GSF_pending_request_get_data_(), GSF_stats, id, GSF_RequestPlan::pe_head, GSF_RequestPlan::pe_tail, plan_count, PeerPlan::plan_map, GSF_PendingRequestPlanBijection::pr, GSF_PendingRequestData::pr_head, GSF_PendingRequestData::pr_tail, PeerPlan::priority_heap, GSF_PendingRequestPlanBijection::rp, and PeerPlan::task.

Referenced by GSF_peer_disconnect_handler().

644 {
645  const struct GNUNET_PeerIdentity *id;
646  struct PeerPlan *pp;
647  struct GSF_RequestPlan *rp;
648  struct GSF_PendingRequestData *prd;
650 
653  if (NULL == pp)
654  return; /* nothing was ever planned for this peer */
657  pp));
658  if (NULL != pp->task)
659  {
661  pp->task = NULL;
662  }
663  while (NULL != (rp = GNUNET_CONTAINER_heap_remove_root (pp->priority_heap)))
664  {
667  get_rp_key (rp),
668  rp));
669  while (NULL != (bi = rp->pe_head))
670  {
672  rp->pe_head,
673  rp->pe_tail,
674  bi);
675  prd = GSF_pending_request_get_data_ (bi->pr);
677  prd->pr_head,
678  prd->pr_tail,
679  bi);
680  GNUNET_free (bi);
681  }
682  plan_count--;
683  GNUNET_free (rp);
684  }
686  while (NULL != (rp = GNUNET_CONTAINER_heap_remove_root (pp->delay_heap)))
687  {
690  get_rp_key (rp),
691  rp));
692  while (NULL != (bi = rp->pe_head))
693  {
694  prd = GSF_pending_request_get_data_ (bi->pr);
696  rp->pe_head,
697  rp->pe_tail,
698  bi);
700  prd->pr_head,
701  prd->pr_tail,
702  bi);
703  GNUNET_free (bi);
704  }
705  plan_count--;
706  GNUNET_free (rp);
707  }
709  gettext_noop ("# query plan entries"),
710  plan_count,
711  GNUNET_NO);
714  GNUNET_free (pp);
715 }
struct GNUNET_CONTAINER_MultiHashMap * plan_map
Map of queries to plan entries.
Transmission plan for a peer.
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
static unsigned long long plan_count
Number of plan entries.
struct GSF_PendingRequestPlanBijection * pr_head
Fields for the plan module to track a DLL with the request.
struct GNUNET_STATISTICS_Handle * GSF_stats
Handle for reporting statistics.
int GNUNET_CONTAINER_multipeermap_remove(struct GNUNET_CONTAINER_MultiPeerMap *map, const struct GNUNET_PeerIdentity *key, const void *value)
Remove the given key-value pair from the map.
#define GNUNET_NO
Definition: gnunet_common.h:81
static struct GNUNET_IDENTITY_Handle * id
Handle to identity service.
static const struct GNUNET_HashCode * get_rp_key(struct GSF_RequestPlan *rp)
Return the query (key in the plan_map) for the given request plan.
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur...
struct GSF_PendingRequestPlanBijection * pe_head
Head of list of associated pending requests.
struct GSF_PendingRequestPlanBijection * pe_tail
Tail of list of associated pending requests.
struct GNUNET_CONTAINER_Heap * delay_heap
Heap with pending queries (struct GSF_RequestPlan), by transmission time, lowest first.
Public data (in the sense of not encapsulated within &#39;gnunet-service-fs_pr&#39;, not in the sense of netw...
void GNUNET_CONTAINER_multihashmap_destroy(struct GNUNET_CONTAINER_MultiHashMap *map)
Destroy a hash map.
#define GNUNET_CONTAINER_MDLL_remove(mdll, head, tail, element)
Remove an element from a MDLL.
int GNUNET_CONTAINER_multihashmap_remove(struct GNUNET_CONTAINER_MultiHashMap *map, const struct GNUNET_HashCode *key, const void *value)
Remove the given key-value pair from the map.
void GNUNET_STATISTICS_set(struct GNUNET_STATISTICS_Handle *handle, const char *name, uint64_t value, int make_persistent)
Set statistic value for the peer.
void GNUNET_CONTAINER_heap_destroy(struct GNUNET_CONTAINER_Heap *heap)
Destroys the heap.
struct GSF_PendingRequest * pr
Associated pending request (identifies request details and one of the origins of the request)...
struct GSF_PendingRequestPlanBijection * pr_tail
Fields for the plan module to track a DLL with the request.
Information we keep per request per peer.
The identity of the host (wraps the signing key of the peer).
struct GSF_PendingRequestData * GSF_pending_request_get_data_(struct GSF_PendingRequest *pr)
Obtain the public data associated with a pending request.
const struct GNUNET_PeerIdentity * GSF_connected_peer_get_identity2_(const struct GSF_ConnectedPeer *cp)
Obtain the identity of a connected peer.
void * GNUNET_CONTAINER_multipeermap_get(const struct GNUNET_CONTAINER_MultiPeerMap *map, const struct GNUNET_PeerIdentity *key)
Given a key find a value in the map matching the key.
void * GNUNET_CONTAINER_heap_remove_root(struct GNUNET_CONTAINER_Heap *heap)
Remove root of the heap.
static char * rp
Relying party.
#define GNUNET_YES
Definition: gnunet_common.h:80
struct GNUNET_SCHEDULER_Task * task
Current task for executing the plan.
static struct GNUNET_CONTAINER_MultiPeerMap * plans
Hash map from peer identities to PeerPlans.
#define GNUNET_free(ptr)
Wrapper around free.
M:N binding of plans to pending requests.
#define gettext_noop(String)
Definition: gettext.h:69
struct GNUNET_CONTAINER_Heap * priority_heap
Heap with pending queries (struct GSF_RequestPlan), higher weights mean higher priority.
void * GNUNET_SCHEDULER_cancel(struct GNUNET_SCHEDULER_Task *task)
Cancel the task with the specified identifier.
Definition: scheduler.c:965
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GSF_request_plan_reference_get_last_transmission_()

int GSF_request_plan_reference_get_last_transmission_ ( struct GSF_PendingRequestPlanBijection pr_head,
struct GSF_ConnectedPeer sender,
struct GNUNET_TIME_Absolute result 
)

Get the last transmission attempt time for the request plan list referenced by pr_head, that was sent to sender.

Get the last transmission attempt time for the request plan list referenced by 'rpr_head', that was sent to 'sender'.

Parameters
pr_headrequest plan reference list to check.
senderthe peer that we've sent the request to.
resultthe timestamp to fill, set to GNUNET_TIME_UNIT_FOREVER_ABS if never transmitted
Returns
GNUNET_YES if result was changed, GNUNET_NO otherwise.

Definition at line 728 of file gnunet-service-fs_pe.c.

References GNUNET_TIME_Absolute::abs_value_us, PeerPlan::cp, GNUNET_NO, GNUNET_TIME_UNIT_FOREVER_ABS, GNUNET_YES, GSF_RequestPlan::last_transmission, GSF_PendingRequestPlanBijection::next_PR, GSF_RequestPlan::pp, and GSF_PendingRequestPlanBijection::rp.

Referenced by process_reply().

731 {
733 
734  for (bi = pr_head; NULL != bi; bi = bi->next_PR)
735  {
736  if (bi->rp->pp->cp == sender)
737  {
738  if (0 == bi->rp->last_transmission.abs_value_us)
740  else
741  *result = bi->rp->last_transmission;
742  return GNUNET_YES;
743  }
744  }
745  return GNUNET_NO;
746 }
#define GNUNET_NO
Definition: gnunet_common.h:81
struct GSF_PendingRequestPlanBijection * next_PR
This is a doubly-linked list.
uint64_t abs_value_us
The actual value.
struct GSF_ConnectedPeer * cp
Peer for which this is the plan.
struct GSF_RequestPlan * rp
Associated request plan (tells us one of the peers that we plan to forward the request to)...
#define GNUNET_TIME_UNIT_FOREVER_ABS
Constant used to specify "forever".
struct PeerPlan * pp
The transmission plan for a peer that this request is associated with.
struct GNUNET_TIME_Absolute last_transmission
When was the last time we transmitted this request to this peer? 0 for never.
#define GNUNET_YES
Definition: gnunet_common.h:80
M:N binding of plans to pending requests.
Here is the caller graph for this function:

◆ GSF_plan_notify_request_done_()

void GSF_plan_notify_request_done_ ( struct GSF_PendingRequest pr)

Notify the plan about a request being done; destroy all entries associated with this request.

Parameters
prrequest that is done

Definition at line 756 of file gnunet-service-fs_pe.c.

References gettext_noop, GNUNET_assert, GNUNET_break, GNUNET_CONTAINER_heap_remove_node(), GNUNET_CONTAINER_MDLL_remove, GNUNET_CONTAINER_multihashmap_remove(), GNUNET_free, GNUNET_NO, GNUNET_STATISTICS_set(), GNUNET_YES, GSF_pending_request_get_data_(), GSF_stats, GSF_RequestPlan::hn, GSF_RequestPlan::pe_head, GSF_RequestPlan::pe_tail, plan_count, PeerPlan::plan_map, GSF_RequestPlan::pp, GSF_PendingRequestPlanBijection::pr, GSF_PendingRequestData::pr_head, GSF_PendingRequestData::pr_tail, GSF_PendingRequestData::query, and GSF_PendingRequestPlanBijection::rp.

Referenced by clean_request(), and GSF_pending_request_cancel_().

757 {
758  struct GSF_RequestPlan *rp;
759  struct GSF_PendingRequestData *prd;
761 
763  while (NULL != (bi = prd->pr_head))
764  {
765  rp = bi->rp;
767  prd->pr_head,
768  prd->pr_tail,
769  bi);
771  rp->pe_head,
772  rp->pe_tail,
773  bi);
774  GNUNET_assert (bi->pr == pr);
775  if (NULL == rp->pe_head)
776  {
778  plan_count--;
781  &prd->query,
782  rp));
783  GNUNET_free (rp);
784  }
785  GNUNET_free (bi);
786  }
788  gettext_noop ("# query plan entries"),
789  plan_count,
790  GNUNET_NO);
791 }
struct GNUNET_CONTAINER_MultiHashMap * plan_map
Map of queries to plan entries.
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
static unsigned long long plan_count
Number of plan entries.
struct GSF_PendingRequestPlanBijection * pr_head
Fields for the plan module to track a DLL with the request.
struct GNUNET_STATISTICS_Handle * GSF_stats
Handle for reporting statistics.
#define GNUNET_NO
Definition: gnunet_common.h:81
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur...
struct GSF_RequestPlan * rp
Associated request plan (tells us one of the peers that we plan to forward the request to)...
struct GNUNET_HashCode query
Primary query hash for this request.
struct GSF_PendingRequestPlanBijection * pe_head
Head of list of associated pending requests.
struct GSF_PendingRequestPlanBijection * pe_tail
Tail of list of associated pending requests.
Public data (in the sense of not encapsulated within &#39;gnunet-service-fs_pr&#39;, not in the sense of netw...
struct PeerPlan * pp
The transmission plan for a peer that this request is associated with.
#define GNUNET_CONTAINER_MDLL_remove(mdll, head, tail, element)
Remove an element from a MDLL.
int GNUNET_CONTAINER_multihashmap_remove(struct GNUNET_CONTAINER_MultiHashMap *map, const struct GNUNET_HashCode *key, const void *value)
Remove the given key-value pair from the map.
void GNUNET_STATISTICS_set(struct GNUNET_STATISTICS_Handle *handle, const char *name, uint64_t value, int make_persistent)
Set statistic value for the peer.
struct GSF_PendingRequest * pr
Associated pending request (identifies request details and one of the origins of the request)...
struct GSF_PendingRequestPlanBijection * pr_tail
Fields for the plan module to track a DLL with the request.
struct GNUNET_CONTAINER_HeapNode * hn
Heap node associated with this request and this peer.
Information we keep per request per peer.
struct GSF_PendingRequestData * GSF_pending_request_get_data_(struct GSF_PendingRequest *pr)
Obtain the public data associated with a pending request.
static char * rp
Relying party.
#define GNUNET_YES
Definition: gnunet_common.h:80
void * GNUNET_CONTAINER_heap_remove_node(struct GNUNET_CONTAINER_HeapNode *node)
Removes a node from the heap.
#define GNUNET_free(ptr)
Wrapper around free.
M:N binding of plans to pending requests.
#define gettext_noop(String)
Definition: gettext.h:69
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GSF_plan_init()

void GSF_plan_init ( void  )

Initialize plan subsystem.

Definition at line 798 of file gnunet-service-fs_pe.c.

References GNUNET_CONTAINER_multipeermap_create(), and GNUNET_YES.

Referenced by run().

799 {
801  GNUNET_YES);
802 }
struct GNUNET_CONTAINER_MultiPeerMap * GNUNET_CONTAINER_multipeermap_create(unsigned int len, int do_not_copy_keys)
Create a multi peer map (hash map for public keys of peers).
#define GNUNET_YES
Definition: gnunet_common.h:80
static struct GNUNET_CONTAINER_MultiPeerMap * plans
Hash map from peer identities to PeerPlans.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GSF_plan_done()

void GSF_plan_done ( void  )

Shutdown plan subsystem.

Definition at line 809 of file gnunet-service-fs_pe.c.

References GNUNET_assert, GNUNET_CONTAINER_multipeermap_destroy(), and GNUNET_CONTAINER_multipeermap_size().

Referenced by shutdown_task().

810 {
813 }
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
void GNUNET_CONTAINER_multipeermap_destroy(struct GNUNET_CONTAINER_MultiPeerMap *map)
Destroy a hash map.
unsigned int GNUNET_CONTAINER_multipeermap_size(const struct GNUNET_CONTAINER_MultiPeerMap *map)
Get the number of key-value pairs in the map.
static struct GNUNET_CONTAINER_MultiPeerMap * plans
Hash map from peer identities to PeerPlans.
Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ plans

struct GNUNET_CONTAINER_MultiPeerMap* plans
static

Hash map from peer identities to PeerPlans.

Definition at line 212 of file gnunet-service-fs_pe.c.

◆ total_delay

unsigned long long total_delay
static

Sum of all transmission counters (equals total delay for all plan entries).

Definition at line 217 of file gnunet-service-fs_pe.c.

Referenced by plan(), and schedule_peer_transmission().

◆ plan_count

unsigned long long plan_count
static

Number of plan entries.

Definition at line 222 of file gnunet-service-fs_pe.c.

Referenced by GSF_plan_add_(), GSF_plan_notify_peer_disconnect_(), GSF_plan_notify_request_done_(), and plan().