ELinks 0.16.1.1
peerconnect.c File Reference
#include <errno.h>
#include <stdio.h>
#include <sys/types.h>
#include "elinks.h"
#include "config/options.h"
#include "main/select.h"
#include "main/timer.h"
#include "network/connection.h"
#include "network/socket.h"
#include "network/state.h"
#include "osdep/osdep.h"
#include "protocol/bittorrent/common.h"
#include "protocol/bittorrent/peerwire.h"
#include "protocol/bittorrent/peerconnect.h"
#include "protocol/bittorrent/piececache.h"
#include "protocol/protocol.h"
#include "protocol/uri.h"
#include "util/bitfield.h"
#include "util/memory.h"
#include "util/string.h"
#include "util/time.h"
Include dependency graph for peerconnect.c:

Macros

#define LISTEN_BACKLOG    get_opt_int("protocol.bittorrent.peerwire.connections", NULL)

Functions

struct bittorrent_connectionfind_bittorrent_connection (bittorrent_id_T info_hash)
static void check_bittorrent_peer_blacklisting (struct bittorrent_peer_connection *peer, struct connection_state state)
static void bittorrent_peer_connection_timeout (struct bittorrent_peer_connection *peer)
void set_bittorrent_peer_connection_timeout (struct bittorrent_peer_connection *peer)
static void set_bittorrent_socket_state (struct socket *socket, struct connection_state state)
static void set_bittorrent_socket_timeout (struct socket *socket, struct connection_state state)
static void retry_bittorrent_socket (struct socket *socket, struct connection_state state)
static void done_bittorrent_socket (struct socket *socket, struct connection_state state)
static struct bittorrent_peer_connectioninit_bittorrent_peer_connection (int socket)
void done_bittorrent_peer_connection (struct bittorrent_peer_connection *peer)
enum bittorrent_state make_bittorrent_peer_connection (struct bittorrent_connection *bittorrent, struct bittorrent_peer *peer_info)
static void accept_bittorrent_peer_connection (void *____)
struct connection_state init_bittorrent_listening_socket (struct connection *conn)
void done_bittorrent_listening_socket (struct connection *conn)

Variables

static int bittorrent_socket = -1
static struct bittorrent_connection list bittorrent_connections = { D_LIST_HEAD(bittorrent_connections) }
static struct bittorrent_peer_connection list bittorrent_peer_connections = { D_LIST_HEAD(bittorrent_peer_connections) }
static struct socket_operations bittorrent_socket_operations

Macro Definition Documentation

◆ LISTEN_BACKLOG

#define LISTEN_BACKLOG    get_opt_int("protocol.bittorrent.peerwire.connections", NULL)

Function Documentation

◆ accept_bittorrent_peer_connection()

void accept_bittorrent_peer_connection ( void * ____)
static

◆ bittorrent_peer_connection_timeout()

void bittorrent_peer_connection_timeout ( struct bittorrent_peer_connection * peer)
static

◆ check_bittorrent_peer_blacklisting()

void check_bittorrent_peer_blacklisting ( struct bittorrent_peer_connection * peer,
struct connection_state state )
static

◆ done_bittorrent_listening_socket()

void done_bittorrent_listening_socket ( struct connection * conn)

◆ done_bittorrent_peer_connection()

void done_bittorrent_peer_connection ( struct bittorrent_peer_connection * peer)

◆ done_bittorrent_socket()

void done_bittorrent_socket ( struct socket * socket,
struct connection_state state )
static

◆ find_bittorrent_connection()

struct bittorrent_connection * find_bittorrent_connection ( bittorrent_id_T info_hash)

◆ init_bittorrent_listening_socket()

struct connection_state init_bittorrent_listening_socket ( struct connection * conn)

◆ init_bittorrent_peer_connection()

struct bittorrent_peer_connection * init_bittorrent_peer_connection ( int socket)
static

◆ make_bittorrent_peer_connection()

enum bittorrent_state make_bittorrent_peer_connection ( struct bittorrent_connection * bittorrent,
struct bittorrent_peer * peer_info )

◆ retry_bittorrent_socket()

void retry_bittorrent_socket ( struct socket * socket,
struct connection_state state )
static

◆ set_bittorrent_peer_connection_timeout()

void set_bittorrent_peer_connection_timeout ( struct bittorrent_peer_connection * peer)

◆ set_bittorrent_socket_state()

void set_bittorrent_socket_state ( struct socket * socket,
struct connection_state state )
static

◆ set_bittorrent_socket_timeout()

void set_bittorrent_socket_timeout ( struct socket * socket,
struct connection_state state )
static

Variable Documentation

◆ bittorrent_connections

struct bittorrent_connection list bittorrent_connections = { D_LIST_HEAD(bittorrent_connections) }
static

◆ bittorrent_peer_connections

struct bittorrent_peer_connection list bittorrent_peer_connections = { D_LIST_HEAD(bittorrent_peer_connections) }
static

◆ bittorrent_socket

int bittorrent_socket = -1
static

◆ bittorrent_socket_operations

struct socket_operations bittorrent_socket_operations
static
Initial value:
= {
}
static void set_bittorrent_socket_state(struct socket *socket, struct connection_state state)
Definition peerconnect.c:146
static void set_bittorrent_socket_timeout(struct socket *socket, struct connection_state state)
Definition peerconnect.c:158
static void retry_bittorrent_socket(struct socket *socket, struct connection_state state)
Definition peerconnect.c:167
static void done_bittorrent_socket(struct socket *socket, struct connection_state state)
Definition peerconnect.c:184