iPXE
|
Peer Content Caching and Retrieval (PeerDist) protocol peer discovery. More...
#include <stdint.h>
#include <ipxe/refcnt.h>
#include <ipxe/list.h>
#include <ipxe/tables.h>
#include <ipxe/retry.h>
#include <ipxe/socket.h>
#include <ipxe/interface.h>
#include <ipxe/pccrc.h>
Go to the source code of this file.
Data Structures | |
struct | peerdisc_socket |
A PeerDist discovery socket. More... | |
struct | peerdisc_segment |
A PeerDist discovery segment. More... | |
struct | peerdisc_peer |
A PeerDist discovery peer. More... | |
struct | peerdisc_client |
A PeerDist discovery client. More... | |
struct | peerdisc_client_operations |
PeerDist discovery client operations. More... | |
Macros | |
#define | PEERDISC_SOCKETS __table ( struct peerdisc_socket, "peerdisc_sockets" ) |
PeerDist discovery socket table. More... | |
#define | __peerdisc_socket __table_entry ( PEERDISC_SOCKETS, 01 ) |
Declare a PeerDist discovery socket. More... | |
#define | peerdisc_stat_TYPE(object_type) |
Functions | |
FILE_LICENCE (GPL2_OR_LATER_OR_UBDL) | |
static void | peerdisc_init (struct peerdisc_client *peerdisc, struct peerdisc_client_operations *op) |
Initialise PeerDist discovery. More... | |
void | peerdisc_stat (struct interface *intf, struct peerdisc_peer *peer, struct list_head *peers) |
Report peer discovery statistics. More... | |
int | peerdisc_open (struct peerdisc_client *peerdisc, const void *id, size_t len) |
Open PeerDist discovery client. More... | |
void | peerdisc_close (struct peerdisc_client *peerdisc) |
Close PeerDist discovery client. More... | |
Variables | |
unsigned int | peerdisc_timeout_secs |
Recommended discovery timeout (in seconds) More... | |
Peer Content Caching and Retrieval (PeerDist) protocol peer discovery.
Definition in file peerdisc.h.
#define PEERDISC_SOCKETS __table ( struct peerdisc_socket, "peerdisc_sockets" ) |
PeerDist discovery socket table.
Definition at line 36 of file peerdisc.h.
struct peerdisc_socket peerdisc_socket_ipv6 __peerdisc_socket __table_entry ( PEERDISC_SOCKETS, 01 ) |
Declare a PeerDist discovery socket.
PeerDist discovery IPv6 socket.
Definition at line 39 of file peerdisc.h.
#define peerdisc_stat_TYPE | ( | object_type | ) |
Definition at line 114 of file peerdisc.h.
FILE_LICENCE | ( | GPL2_OR_LATER_OR_UBDL | ) |
|
inlinestatic |
Initialise PeerDist discovery.
peerdisc | PeerDist discovery client |
op | Discovery operations |
Definition at line 104 of file peerdisc.h.
References peerdisc_client::op, and op.
Referenced by peerblk_open().
void peerdisc_stat | ( | struct interface * | intf, |
struct peerdisc_peer * | peer, | ||
struct list_head * | peers | ||
) |
Report peer discovery statistics.
intf | Interface |
peer | Selected peer (or NULL) |
peers | List of available peers |
Definition at line 100 of file peerdisc.c.
References dest, interface::intf, intf_get_dest_op, intf_object(), intf_put(), op, peerdisc_stat(), and peerdisc_stat_TYPE.
Referenced by peerblk_done(), and peerdisc_stat().
int peerdisc_open | ( | struct peerdisc_client * | peerdisc, |
const void * | id, | ||
size_t | len | ||
) |
Open PeerDist discovery client.
peerdisc | PeerDist discovery client |
id | Segment ID |
len | Length of segment ID |
rc | Return status code |
Definition at line 559 of file peerdisc.c.
References assert(), base16_encoded_len(), ENOMEM, id_string, len, peerdisc_client::list, list_add_tail, list_empty, NULL, peerdisc_create(), peerdisc_find(), peerdisc_socket_open(), rc, ref_get, peerdisc_client::segment, segment, and toupper().
Referenced by peerblk_open().
void peerdisc_close | ( | struct peerdisc_client * | peerdisc | ) |
Close PeerDist discovery client.
peerdisc | PeerDist discovery client |
Definition at line 597 of file peerdisc.c.
References DBGC, peerdisc_client::list, list_del, list_empty, NULL, peerdisc_destroy(), peerdisc_socket_close(), peerdisc_timeout_secs, ref_put, peerdisc_client::segment, and segment.
Referenced by peerblk_close().
unsigned int peerdisc_timeout_secs |
Recommended discovery timeout (in seconds)
We reduce the recommended discovery timeout whenever a segment fails to discover any peers, and restore the default value whenever a valid discovery reply is received. We continue to send discovery requests even if the recommended timeout is reduced to zero.
This strategy is intended to minimise discovery delays when no peers are available on the network, while allowing downloads to quickly switch back to using PeerDist acceleration if new peers become available.
Definition at line 74 of file peerdisc.c.
Referenced by peerblk_open(), peerdisc_close(), and peerdisc_socket_rx().