Project

General

Profile

Bug #191 » bip-0.8.8-enforce-fakelag.patch

Nathan Brink, 2011-09-13 01:24

View differences:

src/connection.c
static int ssl_cx_idx;
static BIO *errbio = NULL;
extern char *conf_ssl_certfile;
static int cn_want_write(connection_t *cn);
static int SSLize(connection_t *cn, int *nc);
static SSL_CTX *SSL_init_context(void);
/* SSH like trust management */
......
return 0;
}
/*
* May only be used when writing to the client or when sending
* timing-sensitive data to the server (PONG, PING for lagtest, QUIT)
* because fakelag is not enforced.
*/
void write_line_fast(connection_t *cn, char *line)
{
int r;
......
void write_lines(connection_t *cn, list_t *lines)
{
list_append(cn->outgoing, lines);
real_write_all(cn);
if (cn_want_write(cn))
real_write_all(cn);
}
void write_line(connection_t *cn, char *line)
{
list_add_last(cn->outgoing, bip_strdup(line));
real_write_all(cn);
if (cn_want_write(cn))
real_write_all(cn);
}
list_t *read_lines(connection_t *cn, int *error)
......
/* token generation interval: 1200ms */
#define TOKEN_INTERVAL 1200
int cn_want_write(connection_t *cn)
static int cn_want_write(connection_t *cn)
{
if (cn->anti_flood) {
struct timeval tv;
(2-2/2)