GNUnet  0.11.x
Typedefs | Enumerations | Functions
gnunet-service-testbed_connectionpool.h File Reference

Interface for connection pooling subroutines. More...

#include "gnunet_ats_service.h"
#include "gnunet_core_service.h"
#include "gnunet_transport_service.h"
Include dependency graph for gnunet-service-testbed_connectionpool.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef void(* GST_connection_pool_connection_ready_cb) (void *cls, struct GNUNET_CORE_Handle *ch, struct GNUNET_TRANSPORT_CoreHandle *th, struct GNUNET_ATS_ConnectivityHandle *ac, const struct GNUNET_PeerIdentity *peer_id, const struct GNUNET_CONFIGURATION_Handle *cfg)
 Functions of this type are called when the needed handle is available for usage. More...
 
typedef void(* GST_connection_pool_peer_connect_notify) (void *cls, const struct GNUNET_PeerIdentity *target)
 Callback to notify when the target peer given to GST_connection_pool_get_handle() is connected. More...
 

Enumerations

enum  GST_ConnectionPool_Service { GST_CONNECTIONPOOL_SERVICE_TRANSPORT = 1, GST_CONNECTIONPOOL_SERVICE_CORE, GST_CONNECTIONPOOL_SERVICE_ATS_CONNECTIVITY }
 The type of service. More...
 

Functions

void GST_connection_pool_init (unsigned int size)
 Initialise the connection pool. More...
 
void GST_connection_pool_destroy (void)
 Cleanup the connection pool. More...
 
struct GST_ConnectionPool_GetHandleGST_connection_pool_get_handle (unsigned int peer_id, const struct GNUNET_CONFIGURATION_Handle *cfg, enum GST_ConnectionPool_Service service, GST_connection_pool_connection_ready_cb cb, void *cb_cls, const struct GNUNET_PeerIdentity *target, GST_connection_pool_peer_connect_notify connect_notify_cb, void *connect_notify_cb_cls)
 Get a connection handle to service. More...
 
void GST_connection_pool_get_handle_done (struct GST_ConnectionPool_GetHandle *gh)
 Relinquish a GST_ConnectionPool_GetHandle object. More...
 

Detailed Description

Interface for connection pooling subroutines.

Author
Sree Harsha Totakura sreeh.nosp@m.arsh.nosp@m.a@tot.nosp@m.akur.nosp@m.a.in

Definition in file gnunet-service-testbed_connectionpool.h.

Typedef Documentation

◆ GST_connection_pool_connection_ready_cb

typedef void(* GST_connection_pool_connection_ready_cb) (void *cls, struct GNUNET_CORE_Handle *ch, struct GNUNET_TRANSPORT_CoreHandle *th, struct GNUNET_ATS_ConnectivityHandle *ac, const struct GNUNET_PeerIdentity *peer_id, const struct GNUNET_CONFIGURATION_Handle *cfg)

Functions of this type are called when the needed handle is available for usage.

These functions are to be registered with the function GST_connection_pool_get_handle(). The corresponding handles will be set upon success. If they are not set, then it signals an error while opening the handles.

Parameters
clsthe closure passed to GST_connection_pool_get_handle()
chthe handle to CORE. Can be NULL if it is not requested
ththe handle to TRANSPORT. Can be NULL if it is not requested
acthe handle to ATS, can be NULL if it is not requested
peer_idthe identity of the peer. Will be NULL if ch is NULL. In other cases, its value being NULL means that CORE connection has failed.
cfgconfiguration of the peer

Definition at line 90 of file gnunet-service-testbed_connectionpool.h.

◆ GST_connection_pool_peer_connect_notify

typedef void(* GST_connection_pool_peer_connect_notify) (void *cls, const struct GNUNET_PeerIdentity *target)

Callback to notify when the target peer given to GST_connection_pool_get_handle() is connected.

Parameters
clsthe closure given to GST_connection_pool_get_handle() for this callback
targetthe peer identity of the target peer

Definition at line 107 of file gnunet-service-testbed_connectionpool.h.

Enumeration Type Documentation

◆ GST_ConnectionPool_Service

The type of service.

Enumerator
GST_CONNECTIONPOOL_SERVICE_TRANSPORT 

Transport service.

GST_CONNECTIONPOOL_SERVICE_CORE 

Core service.

GST_CONNECTIONPOOL_SERVICE_ATS_CONNECTIVITY 

ATS service.

Definition at line 39 of file gnunet-service-testbed_connectionpool.h.

Function Documentation

◆ GST_connection_pool_init()

void GST_connection_pool_init ( unsigned int  size)

Initialise the connection pool.

Parameters
sizethe size of the connection pool. Each entry in the connection pool can handle a connection to each of the services enumerated in GST_ConnectionPool_Service

Definition at line 757 of file gnunet-service-testbed_connectionpool.c.

References GNUNET_assert, GNUNET_CONTAINER_multihashmap32_create(), max_size, and size.

Referenced by testbed_run().

758 {
759  max_size = size;
760  if (0 == max_size)
761  return;
762  GNUNET_assert (NULL == map);
763  map = GNUNET_CONTAINER_multihashmap32_create (((size * 3) / 4) + 1);
764 }
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
static unsigned int max_size
The maximum number of entries that can be present in the connection pool.
struct GNUNET_CONTAINER_MultiHashMap32 * GNUNET_CONTAINER_multihashmap32_create(unsigned int len)
Create a 32-bit key multi hash map.
static unsigned int size
Size of the "table".
Definition: peer.c:67
static struct GNUNET_CONTAINER_MultiHashMap32 * map
A hashmap for quickly finding connections in the connection pool.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GST_connection_pool_destroy()

void GST_connection_pool_destroy ( void  )

Cleanup the connection pool.

Definition at line 771 of file gnunet-service-testbed_connectionpool.c.

References cleanup_iterator(), destroy_pooled_connection(), GNUNET_assert, GNUNET_CONTAINER_DLL_remove, GNUNET_CONTAINER_multihashmap32_destroy(), GNUNET_CONTAINER_multihashmap32_iterate(), and GNUNET_SYSERR.

Referenced by shutdown_task().

772 {
773  struct PooledConnection *entry;
774 
775  if (NULL != map)
776  {
777  GNUNET_assert (
778  GNUNET_SYSERR !=
781  map = NULL;
782  }
783  while (NULL != (entry = head_lru))
784  {
787  }
788  GNUNET_assert (NULL == head_not_pooled);
789 }
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
static void destroy_pooled_connection(struct PooledConnection *entry)
Destroy a PooledConnection object.
static int cleanup_iterator(void *cls, uint32_t key, void *value)
This function will be called for every PooledConnection object in map.
static struct PooledConnection * tail_lru
DLL tail for maitaining the least recently used PooledConnection objects.
int GNUNET_CONTAINER_multihashmap32_iterate(struct GNUNET_CONTAINER_MultiHashMap32 *map, GNUNET_CONTAINER_MulitHashMapIterator32Callback it, void *it_cls)
Iterate over all entries in the map.
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
void GNUNET_CONTAINER_multihashmap32_destroy(struct GNUNET_CONTAINER_MultiHashMap32 *map)
Destroy a 32-bit key hash map.
#define GNUNET_SYSERR
Definition: gnunet_common.h:76
static struct PooledConnection * head_not_pooled
DLL head for maintaining PooledConnection objects that are not added into the connection pool as it w...
static struct PooledConnection * head_lru
DLL head for maitaining the least recently used PooledConnection objects.
static struct GNUNET_CONTAINER_MultiHashMap32 * map
A hashmap for quickly finding connections in the connection pool.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GST_connection_pool_get_handle()

struct GST_ConnectionPool_GetHandle* GST_connection_pool_get_handle ( unsigned int  peer_id,
const struct GNUNET_CONFIGURATION_Handle cfg,
enum GST_ConnectionPool_Service  service,
GST_connection_pool_connection_ready_cb  cb,
void *  cb_cls,
const struct GNUNET_PeerIdentity target,
GST_connection_pool_peer_connect_notify  connect_notify_cb,
void *  connect_notify_cb_cls 
)

Get a connection handle to service.

If the connection is opened before and the connection handle is present in the connection pool, it is returned through cb. peer_id is used for the lookup in the connection pool. If the connection handle is not present in the connection pool, a new connection handle is opened for the service using cfg. Additionally, target, connect_notify_cb can be specified to get notified when target is connected at service.

Note
connect_notify_cb will not be called if target is already connected service level. Use GNUNET_TRANSPORT_check_peer_connected() or a similar function from the respective service's API to check if the target peer is already connected or not. connect_notify_cb will be called only once or never (in case target cannot be connected or is already connected).
Parameters
peer_idthe index of the peer
cfgthe configuration with which the transport handle has to be created if it was not present in the cache
servicethe service of interest
cbthe callback to notify when the transport handle is available
cb_clsthe closure for cb
targetthe peer identify of the peer whose connection to our TRANSPORT subsystem will be notified through the connect_notify_cb. Can be NULL
connect_notify_cbthe callback to call when the target peer is connected. This callback will only be called once or never again (in case the target peer cannot be connected). Can be NULL
connect_notify_cb_clsthe closure for connect_notify_cb
Returns
the handle which can be used cancel or mark that the handle is no longer being used

Definition at line 825 of file gnunet-service-testbed_connectionpool.c.

References GST_ConnectionPool_GetHandle::cb, GST_ConnectionPool_GetHandle::cb_cls, GNUNET_TESTBED_Operation::cb_cls, PooledConnection::cfg, GST_ConnectionPool_GetHandle::connect_notify_cb, GST_ConnectionPool_GetHandle::connect_notify_cb_cls, connection_ready(), PooledConnection::demand, GST_ConnectionPool_GetHandle::entry, expire_task_cancel(), gh, GNUNET_assert, GNUNET_CONFIGURATION_dup(), GNUNET_CONTAINER_DLL_insert, GNUNET_CONTAINER_DLL_insert_tail, GNUNET_CONTAINER_DLL_remove, GNUNET_CONTAINER_multihashmap32_get(), GNUNET_CONTAINER_multihashmap32_put(), GNUNET_CONTAINER_multihashmap32_size(), GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST, GNUNET_new, GNUNET_NO, GNUNET_OK, GNUNET_SCHEDULER_add_now(), GNUNET_TESTBED_operation_begin_wait_(), GNUNET_TESTBED_operation_create_(), GNUNET_TESTBED_operation_queue_insert_(), GNUNET_YES, GST_CONNECTIONPOOL_SERVICE_ATS_CONNECTIVITY, GST_CONNECTIONPOOL_SERVICE_CORE, GST_CONNECTIONPOOL_SERVICE_TRANSPORT, GST_opq_openfds, handle, PooledConnection::handle_ats_connectivity, PooledConnection::handle_core, PooledConnection::handle_transport, PooledConnection::head_waiting, PooledConnection::in_lru, PooledConnection::in_pool, PooledConnection::index, LOG_DEBUG, max_size, PooledConnection::notify_task, op, PooledConnection::op_ats_connectivity, PooledConnection::op_core, PooledConnection::op_transport, oprelease_get_handle_ats_connectivity(), oprelease_get_handle_core(), oprelease_get_handle_transport(), opstart_get_handle_ats_connectivity(), opstart_get_handle_core(), opstart_get_handle_transport(), search_waiting(), GST_ConnectionPool_GetHandle::service, service, PooledConnection::tail_waiting, and GST_ConnectionPool_GetHandle::target.

Referenced by handle_overlay_connect(), handle_remote_overlay_connect(), occ_cache_get_handle_core_cb(), occ_hello_sent_cb(), overlay_connect_get_config(), p2_transport_connect(), and rocc_hello_sent_cb().

834 {
836  struct PooledConnection *entry;
838  void *handle;
839  uint32_t peer_id32;
840 
841  peer_id32 = (uint32_t) peer_id;
842  handle = NULL;
843  entry = NULL;
844  if (NULL != map)
845  entry = GNUNET_CONTAINER_multihashmap32_get (map, peer_id32);
846  if (NULL != entry)
847  {
848  if (entry->in_lru)
849  {
850  GNUNET_assert (0 == entry->demand);
851  expire_task_cancel (entry);
853  entry->in_lru = GNUNET_NO;
854  }
855  switch (service)
856  {
858  handle = entry->handle_transport;
859  if (NULL != handle)
860  LOG_DEBUG ("Found TRANSPORT handle for peer %u\n", entry->index);
861  break;
862 
864  handle = entry->handle_core;
865  if (NULL != handle)
866  LOG_DEBUG ("Found CORE handle for peer %u\n", entry->index);
867  break;
868 
870  handle = entry->handle_ats_connectivity;
871  if (NULL != handle)
872  LOG_DEBUG ("Found ATS CONNECTIVITY handle for peer %u\n", entry->index);
873  break;
874  }
875  }
876  else
877  {
878  entry = GNUNET_new (struct PooledConnection);
879  entry->index = peer_id32;
880  if ((NULL != map) &&
882  {
885  map,
886  entry->index,
887  entry,
889  entry->in_pool = GNUNET_YES;
890  }
891  else
892  {
895  entry);
896  }
897  entry->cfg = GNUNET_CONFIGURATION_dup (cfg);
898  }
899  entry->demand++;
901  gh->entry = entry;
902  gh->cb = cb;
903  gh->cb_cls = cb_cls;
904  gh->target = target;
905  gh->connect_notify_cb = connect_notify_cb;
906  gh->connect_notify_cb_cls = connect_notify_cb_cls;
907  gh->service = service;
909  if (NULL != handle)
910  {
911  if (NULL == entry->notify_task)
912  {
913  if (NULL != search_waiting (entry, entry->head_waiting))
914  entry->notify_task =
916  }
917  return gh;
918  }
919  op = NULL;
920  switch (gh->service)
921  {
923  if (NULL != entry->op_transport)
924  return gh; /* Operation pending */
928  entry->op_transport = op;
929  break;
930 
932  if (NULL != entry->op_core)
933  return gh; /* Operation pending */
937  entry->op_core = op;
938  break;
939 
941  if (NULL != entry->op_ats_connectivity)
942  return gh; /* Operation pending */
943  op =
947  entry->op_ats_connectivity = op;
948  break;
949  }
952  return gh;
953 }
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
static void oprelease_get_handle_core(void *cls)
Function called when the operation responsible for opening a CORE connection is marked as done...
struct GNUNET_TRANSPORT_CoreHandle * handle_transport
The transport handle to the peer corresponding to this entry; can be NULL.
void * cb_cls
Closure for callbacks.
GST_connection_pool_peer_connect_notify connect_notify_cb
The callback to be called for serving notification that the target peer is connected.
static struct GNUNET_SERVICE_Handle * service
Handle to our service instance.
#define GNUNET_CONTAINER_DLL_insert(head, tail, element)
Insert an element at the head of a DLL.
The request handle for obtaining a pooled connection.
static struct PooledConnection * tail_lru
DLL tail for maitaining the least recently used PooledConnection objects.
const struct GNUNET_PeerIdentity * target
The peer identity of the target peer.
struct GNUNET_TESTBED_Operation * op_transport
The operation handle for transport handle.
struct GST_ConnectionPool_GetHandle * tail_waiting
DLL tail for the queue of GST_ConnectionPool_GetHandle requests that are waiting for this connection ...
static void oprelease_get_handle_transport(void *cls)
Function called when the operation responsible for opening a TRANSPORT connection is marked as done...
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
static void oprelease_get_handle_ats_connectivity(void *cls)
Function called when the operation responsible for opening a ATS connection is marked as done...
struct GNUNET_CONFIGURATION_Handle * cfg
The configuration of the peer.
struct GNUNET_TESTBED_Operation * GNUNET_TESTBED_operation_create_(void *cls, OperationStart start, OperationRelease release)
Create an 'operation' to be performed.
int in_pool
Is this entry present in the connection pool.
void * connect_notify_cb_cls
The closure for the notify callback.
static void opstart_get_handle_transport(void *cls)
Function called when resources for opening a connection to TRANSPORT are available.
static char * peer_id
Option –peer.
Definition: gnunet-cadet.c:42
#define GNUNET_NO
Definition: gnunet_common.h:78
#define GNUNET_OK
Named constants for return values.
Definition: gnunet_common.h:75
struct GNUNET_TESTBED_Operation * op_core
The operation handle for core handle.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
struct GNUNET_SCHEDULER_Task * notify_task
The task to notify a waiting GST_ConnectionPool_GetHandle object.
void GNUNET_TESTBED_operation_queue_insert_(struct OperationQueue *queue, struct GNUNET_TESTBED_Operation *op)
Add an operation to a queue.
int GNUNET_CONTAINER_multihashmap32_put(struct GNUNET_CONTAINER_MultiHashMap32 *map, uint32_t key, void *value, enum GNUNET_CONTAINER_MultiHashMapOption opt)
Store a key-value pair in the map.
struct OperationQueue * GST_opq_openfds
Operation queue for open file descriptors.
Opaque handle to an abstract operation to be executed by the testing framework.
uint32_t index
The index of this peer.
struct GNUNET_CORE_Handle * handle_core
The core handle to the peer corresponding to this entry; can be NULL.
static void connection_ready(void *cls)
A handle in the PooledConnection object pointed by cls is ready and there is a GST_ConnectionPool_Get...
static struct GST_ConnectionPool_GetHandle * search_waiting(const struct PooledConnection *entry, struct GST_ConnectionPool_GetHandle *head)
Function to find a GST_ConnectionPool_GetHandle which is waiting for one of the handles in given entr...
GST_connection_pool_connection_ready_cb cb
The cache callback to call when a handle is available.
, ' bother checking if a value already exists (faster than GNUNET_CONTAINER_MULTIHASHMAPOPTION_...
unsigned int demand
Number of active requests using this pooled connection.
void * GNUNET_CONTAINER_multihashmap32_get(const struct GNUNET_CONTAINER_MultiHashMap32 *map, uint32_t key)
Given a key find a value in the map matching the key.
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:1280
unsigned int GNUNET_CONTAINER_multihashmap32_size(const struct GNUNET_CONTAINER_MultiHashMap32 *map)
Get the number of key-value pairs in the map.
static struct GNUNET_DNS_Handle * handle
Handle to transport service.
enum GST_ConnectionPool_Service service
The service we want to connect to.
struct GST_ConnectionPool_GetHandle * head_waiting
DLL head for the queue of GST_ConnectionPool_GetHandle requests that are waiting for this connection ...
static unsigned int max_size
The maximum number of entries that can be present in the connection pool.
struct PooledConnection * entry
The pooled connection object this handle corresponds to.
struct GNUNET_TESTBED_Operation * op_ats_connectivity
The operation handle for ATS handle.
static struct PooledConnection * head_not_pooled
DLL head for maintaining PooledConnection objects that are not added into the connection pool as it w...
static void opstart_get_handle_core(void *cls)
Function called when resources for opening a connection to CORE are available.
#define GNUNET_CONTAINER_DLL_insert_tail(head, tail, element)
Insert an element at the tail of a DLL.
void * cb_cls
The closure for the above callback.
static struct PooledConnection * tail_not_pooled
DLL tail for maintaining PooledConnection objects that are not added into the connection pool as it w...
struct GNUNET_CONFIGURATION_Handle * GNUNET_CONFIGURATION_dup(const struct GNUNET_CONFIGURATION_Handle *cfg)
Duplicate an existing configuration object.
void GNUNET_TESTBED_operation_begin_wait_(struct GNUNET_TESTBED_Operation *op)
Marks the given operation as waiting on the queues.
static struct PooledConnection * head_lru
DLL head for maitaining the least recently used PooledConnection objects.
static struct GNUNET_TRANSPORT_HelloGetHandle * gh
Pending GNUNET_TRANSPORT_hello_get() operation.
#define GNUNET_YES
Definition: gnunet_common.h:77
static struct GNUNET_CONTAINER_MultiHashMap32 * map
A hashmap for quickly finding connections in the connection pool.
static struct GNUNET_ARM_Operation * op
Current operation.
Definition: gnunet-arm.c:144
struct GNUNET_ATS_ConnectivityHandle * handle_ats_connectivity
The ATS handle to the peer correspondign to this entry; can be NULL.
static void opstart_get_handle_ats_connectivity(void *cls)
Function called when resources for opening a connection to ATS are available.
#define LOG_DEBUG(...)
Debug logging shorthand.
static void expire_task_cancel(struct PooledConnection *entry)
Cancel the expiration task of the give PooledConnection object.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GST_connection_pool_get_handle_done()

void GST_connection_pool_get_handle_done ( struct GST_ConnectionPool_GetHandle gh)

Relinquish a GST_ConnectionPool_GetHandle object.

If the connection associated with the object is currently being used by other GST_ConnectionPool_GetHandle objects, it is left in the connection pool. If no other objects are using the connection and the connection pool is not full then it is placed in a LRU queue. If the connection pool is full, then connections from the LRU queue are evicted and closed to create place for this connection. If the connection pool if full and the LRU queue is empty, then the connection is closed.

Parameters
ghthe handle

Definition at line 969 of file gnunet-service-testbed_connectionpool.c.

References add_to_lru(), GST_ConnectionPool_GetHandle::connection_ready_called, PooledConnection::demand, destroy_pooled_connection(), GST_ConnectionPool_GetHandle::entry, GNUNET_assert, GNUNET_CONTAINER_DLL_remove, GNUNET_CONTAINER_multihashmap32_contains(), GNUNET_CONTAINER_multihashmap32_put(), GNUNET_CONTAINER_multihashmap32_size(), GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY, GNUNET_free, GNUNET_OK, GNUNET_SCHEDULER_cancel(), GNUNET_YES, PooledConnection::head_notify, PooledConnection::head_waiting, PooledConnection::in_lru, PooledConnection::in_pool, PooledConnection::index, LOG_DEBUG, max_size, PooledConnection::notify_task, GST_ConnectionPool_GetHandle::notify_waiting, search_waiting(), GST_ConnectionPool_GetHandle::service, PooledConnection::tail_notify, and PooledConnection::tail_waiting.

Referenced by cleanup_occ(), cleanup_occ_lp2c(), cleanup_rocc(), and hello_update_cb().

970 {
971  struct PooledConnection *entry;
972 
973  if (NULL == gh)
974  return;
975  entry = gh->entry;
976  LOG_DEBUG ("Cleaning up get handle %p for service %u, peer %u\n",
977  gh,
978  gh->service,
979  entry->index);
980  if (! gh->connection_ready_called)
981  {
983  if ((NULL == search_waiting (entry, entry->head_waiting)) &&
984  (NULL != entry->notify_task))
985  {
987  entry->notify_task = NULL;
988  }
989  }
990  if (gh->notify_waiting)
991  {
993  gh->notify_waiting = 0;
994  }
995  GNUNET_free (gh);
996  gh = NULL;
997  GNUNET_assert (! entry->in_lru);
998  if (! entry->in_pool)
1000  if (NULL != map)
1001  {
1002  if (GNUNET_YES ==
1004  goto unallocate;
1006  {
1007  if (NULL == head_lru)
1008  goto unallocate;
1010  }
1013  map,
1014  entry->index,
1015  entry,
1017  entry->in_pool = GNUNET_YES;
1018  }
1019 
1020 unallocate:
1021  GNUNET_assert (0 < entry->demand);
1022  entry->demand--;
1023  if (0 != entry->demand)
1024  return;
1025  if (entry->in_pool)
1026  {
1027  add_to_lru (entry);
1028  return;
1029  }
1030  destroy_pooled_connection (entry);
1031 }
static void add_to_lru(struct PooledConnection *entry)
Function to add a PooledConnection object into LRU and begin the expiry task.
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
static void destroy_pooled_connection(struct PooledConnection *entry)
Destroy a PooledConnection object.
int notify_waiting
Are we waiting for any peer connect notifications?
struct GST_ConnectionPool_GetHandle * tail_notify
DLL tail for the queue to serve notifications when a peer is connected.
struct GST_ConnectionPool_GetHandle * tail_waiting
DLL tail for the queue of GST_ConnectionPool_GetHandle requests that are waiting for this connection ...
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
int in_pool
Is this entry present in the connection pool.
#define GNUNET_OK
Named constants for return values.
Definition: gnunet_common.h:75
struct GST_ConnectionPool_GetHandle * head_notify
DLL head for the queue to serve notifications when a peer is connected.
struct GNUNET_SCHEDULER_Task * notify_task
The task to notify a waiting GST_ConnectionPool_GetHandle object.
int GNUNET_CONTAINER_multihashmap32_put(struct GNUNET_CONTAINER_MultiHashMap32 *map, uint32_t key, void *value, enum GNUNET_CONTAINER_MultiHashMapOption opt)
Store a key-value pair in the map.
uint32_t index
The index of this peer.
static struct GST_ConnectionPool_GetHandle * search_waiting(const struct PooledConnection *entry, struct GST_ConnectionPool_GetHandle *head)
Function to find a GST_ConnectionPool_GetHandle which is waiting for one of the handles in given entr...
unsigned int demand
Number of active requests using this pooled connection.
int GNUNET_CONTAINER_multihashmap32_contains(const struct GNUNET_CONTAINER_MultiHashMap32 *map, uint32_t key)
Check if the map contains any value under the given key (including values that are NULL)...
unsigned int GNUNET_CONTAINER_multihashmap32_size(const struct GNUNET_CONTAINER_MultiHashMap32 *map)
Get the number of key-value pairs in the map.
enum GST_ConnectionPool_Service service
The service we want to connect to.
struct GST_ConnectionPool_GetHandle * head_waiting
DLL head for the queue of GST_ConnectionPool_GetHandle requests that are waiting for this connection ...
static unsigned int max_size
The maximum number of entries that can be present in the connection pool.
struct PooledConnection * entry
The pooled connection object this handle corresponds to.
There must only be one value per key; storing a value should fail if a value under the same key alrea...
static struct PooledConnection * head_not_pooled
DLL head for maintaining PooledConnection objects that are not added into the connection pool as it w...
static struct PooledConnection * tail_not_pooled
DLL tail for maintaining PooledConnection objects that are not added into the connection pool as it w...
int connection_ready_called
Did we call the pool_connection_ready_cb already?
static struct PooledConnection * head_lru
DLL head for maitaining the least recently used PooledConnection objects.
#define GNUNET_YES
Definition: gnunet_common.h:77
static struct GNUNET_CONTAINER_MultiHashMap32 * map
A hashmap for quickly finding connections in the connection pool.
#define LOG_DEBUG(...)
Debug logging shorthand.
#define GNUNET_free(ptr)
Wrapper around free.
void * GNUNET_SCHEDULER_cancel(struct GNUNET_SCHEDULER_Task *task)
Cancel the task with the specified identifier.
Definition: scheduler.c:966
Here is the call graph for this function:
Here is the caller graph for this function: