GNUnet 0.22.2
gnunet-service-fs_push.h File Reference

support for pushing out content More...

Include dependency graph for gnunet-service-fs_push.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void GSF_push_init_ (void)
 Setup the module. More...
 
void GSF_push_done_ (void)
 Shutdown the module. More...
 
void GSF_push_start_ (struct GSF_ConnectedPeer *peer)
 A peer connected to us or we are now again allowed to push content. More...
 
void GSF_push_stop_ (struct GSF_ConnectedPeer *peer)
 A peer disconnected from us or asked us to stop pushing content for a while. More...
 

Detailed Description

support for pushing out content

Author
Christian Grothoff

Definition in file gnunet-service-fs_push.h.

Function Documentation

◆ GSF_push_init_()

void GSF_push_init_ ( void  )

Setup the module.

Definition at line 625 of file gnunet-service-fs_push.c.

626{
627 enabled =
629 "FS",
630 "CONTENT_PUSHING");
631 if (GNUNET_YES != enabled)
632 return;
633
634 if (GNUNET_OK !=
636 "fs",
637 "MIN_MIGRATION_DELAY",
639 {
641 "fs",
642 "MIN_MIGRATION_DELAY",
643 _ ("time required, content pushing disabled"));
644 return;
645 }
647}
const struct GNUNET_CONFIGURATION_Handle * GSF_cfg
Our configuration.
static int enabled
Is this module enabled?
static struct GNUNET_TIME_Relative min_migration_delay
What is the maximum frequency at which we are allowed to poll the datastore for migration content?
static void consider_gathering(void)
If the migration task is not currently running, consider (re)scheduling it with the appropriate delay...
enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_get_value_yesno(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option)
Get a configuration value that should be in a set of "YES" or "NO".
enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_get_value_time(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option, struct GNUNET_TIME_Relative *time)
Get a configuration value that should be a relative time.
@ GNUNET_OK
@ GNUNET_YES
void GNUNET_log_config_invalid(enum GNUNET_ErrorType kind, const char *section, const char *option, const char *required)
Log error message about invalid configuration option value.
@ GNUNET_ERROR_TYPE_WARNING
#define _(String)
GNU gettext support macro.
Definition: platform.h:179

References _, consider_gathering(), enabled, GNUNET_CONFIGURATION_get_value_time(), GNUNET_CONFIGURATION_get_value_yesno(), GNUNET_ERROR_TYPE_WARNING, GNUNET_log_config_invalid(), GNUNET_OK, GNUNET_YES, GSF_cfg, and min_migration_delay.

Referenced by run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GSF_push_done_()

void GSF_push_done_ ( void  )

Shutdown the module.

Definition at line 654 of file gnunet-service-fs_push.c.

655{
656 if (NULL != mig_task)
657 {
659 mig_task = NULL;
660 }
661 if (NULL != mig_qe)
662 {
664 mig_qe = NULL;
665 }
666 while (NULL != mig_head)
668 GNUNET_assert (0 == mig_size);
669}
static unsigned int mig_size
Size of the doubly-linked list of migration blocks.
static struct GNUNET_SCHEDULER_Task * mig_task
ID of task that collects blocks for migration.
static struct MigrationReadyBlock * mig_head
Head of linked list of blocks that can be migrated.
static void delete_migration_block(struct MigrationReadyBlock *mb)
Delete the given migration block.
static struct GNUNET_DATASTORE_QueueEntry * mig_qe
Request to datastore for migration (or NULL).
void GNUNET_DATASTORE_cancel(struct GNUNET_DATASTORE_QueueEntry *qe)
Cancel a datastore operation.
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
void * GNUNET_SCHEDULER_cancel(struct GNUNET_SCHEDULER_Task *task)
Cancel the task with the specified identifier.
Definition: scheduler.c:980

References delete_migration_block(), GNUNET_assert, GNUNET_DATASTORE_cancel(), GNUNET_SCHEDULER_cancel(), mig_head, mig_qe, mig_size, and mig_task.

Referenced by shutdown_task().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GSF_push_start_()

void GSF_push_start_ ( struct GSF_ConnectedPeer peer)

A peer connected to us or we are now again allowed to push content.

Start pushing content to this peer.

Parameters
peerhandle for the peer that connected

A peer connected to us or we are now again allowed to push content.

Start pushing content to this peer.

Parameters
peerhandle for the peer that connected

Definition at line 567 of file gnunet-service-fs_push.c.

568{
569 struct MigrationReadyPeer *mrp;
570
571 if (GNUNET_YES != enabled)
572 return;
573 for (mrp = peer_head; NULL != mrp; mrp = mrp->next)
574 if (mrp->peer == peer)
575 break;
576 if (NULL != mrp)
577 {
578 /* same peer added twice, must not happen */
579 GNUNET_break (0);
580 return;
581 }
582
584 "Adding peer %s to list for pushing\n",
586
587 mrp = GNUNET_new (struct MigrationReadyPeer);
588 mrp->peer = peer;
589 find_content (mrp);
591 peer_tail,
592 mrp);
593}
const struct GNUNET_PeerIdentity * GSF_connected_peer_get_identity2_(const struct GSF_ConnectedPeer *cp)
Obtain the identity of a connected peer.
static struct MigrationReadyPeer * peer_head
Head of linked list of peers.
static void find_content(void *cls)
Find content for migration to this peer.
static struct MigrationReadyPeer * peer_tail
Tail of linked list of peers.
#define GNUNET_CONTAINER_DLL_insert(head, tail, element)
Insert an element at the head of a DLL.
#define GNUNET_log(kind,...)
const char * GNUNET_i2s(const struct GNUNET_PeerIdentity *pid)
Convert a peer identity to a string (for printing debug messages).
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur.
@ GNUNET_ERROR_TYPE_DEBUG
#define GNUNET_new(type)
Allocate a struct or union of the given type.
Information about a peer waiting for migratable data.
struct GSF_ConnectedPeer * peer
Handle to peer.
struct MigrationReadyPeer * next
This is a doubly-linked list.

References enabled, find_content(), GNUNET_break, GNUNET_CONTAINER_DLL_insert, GNUNET_ERROR_TYPE_DEBUG, GNUNET_i2s(), GNUNET_log, GNUNET_new, GNUNET_YES, GSF_connected_peer_get_identity2_(), MigrationReadyPeer::next, MigrationReadyPeer::peer, peer_head, and peer_tail.

Referenced by peer_respect_cb(), and revive_migration().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GSF_push_stop_()

void GSF_push_stop_ ( struct GSF_ConnectedPeer peer)

A peer disconnected from us or asked us to stop pushing content for a while.

Stop pushing content to this peer.

Parameters
peerhandle for the peer that disconnected

A peer disconnected from us or asked us to stop pushing content for a while.

Stop pushing content to this peer.

Parameters
peerhandle for the peer that disconnected

Definition at line 603 of file gnunet-service-fs_push.c.

604{
605 struct MigrationReadyPeer *pos;
606
607 for (pos = peer_head; NULL != pos; pos = pos->next)
608 if (pos->peer == peer)
609 break;
610 if (NULL == pos)
611 return;
612 if (NULL != pos->env)
615 peer_tail,
616 pos);
617 GNUNET_free (pos);
618}
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
#define GNUNET_free(ptr)
Wrapper around free.
void GNUNET_MQ_send_cancel(struct GNUNET_MQ_Envelope *ev)
Cancel sending the message.
Definition: mq.c:785
struct GNUNET_MQ_Envelope * env
Envelope of the currently pushed message.

References MigrationReadyPeer::env, GNUNET_CONTAINER_DLL_remove, GNUNET_free, GNUNET_MQ_send_cancel(), MigrationReadyPeer::next, MigrationReadyPeer::peer, peer_head, and peer_tail.

Referenced by GSF_peer_disconnect_handler(), and handle_p2p_migration_stop().

Here is the call graph for this function:
Here is the caller graph for this function: