Project

General

Profile

Bug #191 » 0001-Throttle-everything-sent-to-the-IRCd.-Fixes-being-ki.patch

Nathan Brink, 2011-01-21 19:32

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 */
......
int r;
char *nline = bip_strdup(line);
if (cn->partial) {
if (cn->partial
|| !cn_want_write(cn)) {
list_add_first(cn->outgoing, nline);
} else {
r = write_socket(cn, nline);
......
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;
(1-1/2)