Allow to configure the delay before a reconnection
Initial patch submitted by Romain Gayon, thanks to him !
This commit is contained in:
parent
73483ff088
commit
4eec084452
@ -115,6 +115,12 @@ depending on \fBlog_format\fP.
|
||||
Defines the delay between each logfiles sync to the disk. Must be a non null
|
||||
positive integer.
|
||||
|
||||
.TP
|
||||
\fBreconn_timer\fP (default: \fB120\fP)
|
||||
Defines the initial delay (in seconds) before a reconnection attempt.
|
||||
The delay increases with the number of attempts:
|
||||
delay = reconn_timer * number of attempts
|
||||
|
||||
.TP
|
||||
\fBpid_file\fP (default: \fBHOME/.bip/bip.pid\fP)
|
||||
Defines the file where BIP's pid will be stored. BIP checks if this file exists
|
||||
|
@ -57,6 +57,11 @@ log_level = 3;
|
||||
# Sets the frequency (in seconds) of log syncing (real write to kernel)
|
||||
#log_sync_interval = 5;
|
||||
|
||||
# Sets the initial delay (in seconds) before a reconnection attempt.
|
||||
# The delay increases with the number of attempts:
|
||||
# delay = reconn_timer * number of attempts
|
||||
#reconn_timer = 120;
|
||||
|
||||
# Network definition, a name and server info
|
||||
network {
|
||||
name = "iiens";
|
||||
|
@ -45,6 +45,7 @@ char *conf_ssl_certfile;
|
||||
int conf_daemonize;
|
||||
char *conf_pid_file;
|
||||
char *conf_biphome;
|
||||
int conf_reconn_timer;
|
||||
|
||||
/* log options, for sure the trickiest :) */
|
||||
int conf_log = DEFAULT_LOG;
|
||||
@ -989,6 +990,9 @@ int fireup(bip_t *bip, FILE *conf)
|
||||
case LEX_PORT:
|
||||
conf_port = t->ndata;
|
||||
break;
|
||||
case LEX_RECONN_TIMER:
|
||||
conf_reconn_timer = t->ndata;
|
||||
break;
|
||||
#ifdef HAVE_LIBSSL
|
||||
case LEX_CSS:
|
||||
conf_css = t->ndata;
|
||||
@ -1179,6 +1183,7 @@ int main(int argc, char **argv)
|
||||
conf_log_root = NULL;
|
||||
conf_log_format = bip_strdup(DEFAULT_LOG_FORMAT);
|
||||
conf_log_level = DEFAULT_LOG_LEVEL;
|
||||
conf_reconn_timer = DEFAULT_RECONN_TIMER;
|
||||
conf_daemonize = 1;
|
||||
conf_global_log_file = stderr;
|
||||
conf_pid_file = NULL;
|
||||
|
@ -68,7 +68,7 @@ struct tuple *tuple_l_new(int type, void *p)
|
||||
|
||||
%}
|
||||
|
||||
%token LEX_IP LEX_EQ LEX_PORT LEX_CSS LEX_SEMICOLON LEX_CONNECTION LEX_NETWORK LEX_LBRA LEX_RBRA LEX_USER LEX_NAME LEX_NICK LEX_SERVER LEX_PASSWORD LEX_SRCIP LEX_HOST LEX_VHOST LEX_SOURCE_PORT LEX_NONE LEX_COMMENT LEX_BUNCH LEX_REALNAME LEX_SSL LEX_SSL_CHECK_MODE LEX_SSL_CHECK_STORE LEX_SSL_CLIENT_CERTFILE LEX_CHANNEL LEX_KEY LEX_LOG_ROOT LEX_LOG_FORMAT LEX_LOG_LEVEL LEX_BACKLOG_LINES LEX_BACKLOG_NO_TIMESTAMP LEX_BACKLOG LEX_LOG LEX_LOG_SYSTEM LEX_LOG_SYNC_INTERVAL LEX_FOLLOW_NICK LEX_ON_CONNECT_SEND LEX_AWAY_NICK LEX_PID_FILE LEX_IGN_FIRST_NICK LEX_ALWAYS_BACKLOG LEX_BLRESET_ON_TALK LEX_BLRESET_CONNECTION LEX_DEFAULT_USER LEX_DEFAULT_NICK LEX_DEFAULT_REALNAME LEX_NO_CLIENT_AWAY_MSG LEX_BL_MSG_ONLY LEX_ADMIN LEX_BIP_USE_NOTICE LEX_CSS_PEM LEX_AUTOJOIN_ON_KICK LEX_IGNORE_CAPAB
|
||||
%token LEX_IP LEX_EQ LEX_PORT LEX_CSS LEX_SEMICOLON LEX_CONNECTION LEX_NETWORK LEX_LBRA LEX_RBRA LEX_USER LEX_NAME LEX_NICK LEX_SERVER LEX_PASSWORD LEX_SRCIP LEX_HOST LEX_VHOST LEX_SOURCE_PORT LEX_NONE LEX_COMMENT LEX_BUNCH LEX_REALNAME LEX_SSL LEX_SSL_CHECK_MODE LEX_SSL_CHECK_STORE LEX_SSL_CLIENT_CERTFILE LEX_CHANNEL LEX_KEY LEX_LOG_ROOT LEX_LOG_FORMAT LEX_LOG_LEVEL LEX_BACKLOG_LINES LEX_BACKLOG_NO_TIMESTAMP LEX_BACKLOG LEX_LOG LEX_LOG_SYSTEM LEX_LOG_SYNC_INTERVAL LEX_FOLLOW_NICK LEX_ON_CONNECT_SEND LEX_AWAY_NICK LEX_PID_FILE LEX_IGN_FIRST_NICK LEX_ALWAYS_BACKLOG LEX_BLRESET_ON_TALK LEX_BLRESET_CONNECTION LEX_DEFAULT_USER LEX_DEFAULT_NICK LEX_DEFAULT_REALNAME LEX_NO_CLIENT_AWAY_MSG LEX_BL_MSG_ONLY LEX_ADMIN LEX_BIP_USE_NOTICE LEX_CSS_PEM LEX_AUTOJOIN_ON_KICK LEX_IGNORE_CAPAB LEX_RECONN_TIMER
|
||||
|
||||
%union {
|
||||
int number;
|
||||
@ -94,6 +94,7 @@ command:
|
||||
| LEX_LOG_FORMAT LEX_EQ LEX_STRING { $$ = tuple_s_new(LEX_LOG_FORMAT,
|
||||
$3); }
|
||||
| LEX_LOG_LEVEL LEX_EQ LEX_INT { $$ = tuple_i_new(LEX_LOG_LEVEL, $3); }
|
||||
| LEX_RECONN_TIMER LEX_EQ LEX_INT { $$ = tuple_i_new(LEX_RECONN_TIMER, $3); }
|
||||
| LEX_IP LEX_EQ LEX_STRING { $$ = tuple_s_new(LEX_IP, $3); }
|
||||
| LEX_PORT LEX_EQ LEX_INT { $$ = tuple_i_new(LEX_PORT, $3); }
|
||||
| LEX_CSS LEX_EQ LEX_BOOL { $$ = tuple_i_new(LEX_CSS, $3); }
|
||||
|
@ -27,5 +27,6 @@
|
||||
#define DEFAULT_LOG_LEVEL LOG_INFO
|
||||
#define DEFAULT_LOG_FORMAT "%u/%n/%Y-%m/%c.%d.log"
|
||||
#define DEFAULT_BIP_USE_NOTICE 0
|
||||
#define DEFAULT_RECONN_TIMER 120
|
||||
|
||||
#endif /* DEFAULTS_H */
|
||||
|
@ -61,6 +61,7 @@ void oidentd_dump(bip_t *bip);
|
||||
|
||||
void irc_client_free(struct link_client *cli);
|
||||
extern int conf_log_sync_interval;
|
||||
extern int conf_reconn_timer;
|
||||
|
||||
void write_user_list(connection_t *c, char *dest);
|
||||
|
||||
@ -72,7 +73,6 @@ int irc_cli_bip(bip_t *bip, struct link_client *ic, struct line *line);
|
||||
|
||||
#define LAGOUT_TIME 480
|
||||
#define LAGCHECK_TIME (90)
|
||||
#define RECONN_TIMER (120)
|
||||
#define RECONN_TIMER_MAX (600)
|
||||
#define LOGGING_TIMEOUT (360)
|
||||
#define CONN_INTERVAL 60
|
||||
@ -2046,7 +2046,7 @@ static void server_setup_reconnect_timer(struct link *link)
|
||||
if (link->last_connection_attempt &&
|
||||
time(NULL) - link->last_connection_attempt
|
||||
< CONN_INTERVAL) {
|
||||
timer = RECONN_TIMER * (link->s_conn_attempt);
|
||||
timer = conf_reconn_timer * (link->s_conn_attempt);
|
||||
if (timer > RECONN_TIMER_MAX)
|
||||
timer = RECONN_TIMER_MAX;
|
||||
}
|
||||
|
@ -109,6 +109,7 @@ list_t *parse_conf(FILE *file, int *err)
|
||||
"bip_use_notice" { return LEX_BIP_USE_NOTICE; }
|
||||
"client_side_ssl_pem" { return LEX_CSS_PEM; }
|
||||
"ignore_server_capab" { return LEX_IGNORE_CAPAB; }
|
||||
"reconn_timer" { return LEX_RECONN_TIMER; }
|
||||
\"[^"]*\" {
|
||||
size_t len = strlen(yytext) - 2;
|
||||
yylval.string = bip_malloc(len + 1);
|
||||
|
Loading…
Reference in New Issue
Block a user