From: michael Date: Tue, 9 Jun 2015 18:22:56 +0000 (+0000) Subject: - Made the RECONNECTINTERVAL configurable via the hopm.conf X-Git-Tag: 1.0.8~46 X-Git-Url: http://git.serene-ircd.net/?a=commitdiff_plain;h=8beffaf4feeb55596616c5289b393033f4ad11fe;p=hopm.git - Made the RECONNECTINTERVAL configurable via the hopm.conf git-svn-id: svn://svn.ircd-hybrid.org/svnroot/hopm/branches/1.0.x@6079 82007160-df01-0410-b94d-b575c5fd34c7 --- diff --git a/doc/reference.conf b/doc/reference.conf index 8dd0728..a2b2967 100644 --- a/doc/reference.conf +++ b/doc/reference.conf @@ -119,6 +119,11 @@ irc { */ readtimeout = 15 minutes; + /* + * Interval in how often we try to reconnect to the IRC server + */ + reconnectinterval = 30 seconds; + /* * Command to execute to identify to NickServ (if your network uses * it). This is the raw IRC command text, and the below example diff --git a/src/config-lexer.l b/src/config-lexer.l index 97cb368..c98748d 100644 --- a/src/config-lexer.l +++ b/src/config-lexer.l @@ -120,6 +120,7 @@ PORT { return PORT; } PROTOCOL { return PROTOCOL; } READTIMEOUT { return READTIMEOUT; } REALNAME { return REALNAME; } +RECONNECTINTERVAL { return RECONNECTINTERVAL; } REPLY { return REPLY; } SCANLOG { return SCANLOG; } SCANNER { return SCANNER; } diff --git a/src/config-parser.y b/src/config-parser.y index 907766f..858d83c 100644 --- a/src/config-parser.y +++ b/src/config-parser.y @@ -65,6 +65,7 @@ static void *tmp; /* Variable to temporarily hold nodes before insertion to lis %token PROTOCOL %token READTIMEOUT %token REALNAME +%token RECONNECTINTERVAL %token REPLY %token SCANLOG %token SCANNER @@ -173,23 +174,24 @@ irc_entry: IRC '{' irc_items '}' ';'; irc_items: irc_items irc_item | irc_item; -irc_item: irc_away | - irc_connregex | - irc_kline | - irc_nick | - irc_nickserv | - irc_mode | - irc_oper | - irc_password | - irc_port | - irc_readtimeout | - irc_realname | - irc_server | - irc_username | - irc_vhost | - irc_perform | - irc_notice | - channel_entry | +irc_item: irc_away | + irc_connregex | + irc_kline | + irc_nick | + irc_nickserv | + irc_mode | + irc_oper | + irc_password | + irc_port | + irc_readtimeout | + irc_reconnectinterval | + irc_realname | + irc_server | + irc_username | + irc_vhost | + irc_perform | + irc_notice | + channel_entry | error; irc_away: AWAY '=' STRING ';' @@ -260,6 +262,11 @@ irc_readtimeout: READTIMEOUT '=' timespec ';' IRCItem->readtimeout = $3; }; +irc_reconnectinterval: RECONNECTINTERVAL '=' timespec ';' +{ + IRCItem->reconnectinterval = $3; +}; + irc_realname: REALNAME '=' STRING ';' { xfree(IRCItem->realname); diff --git a/src/config.c b/src/config.c index 1998f00..7009763 100644 --- a/src/config.c +++ b/src/config.c @@ -82,6 +82,7 @@ config_setup(void) IRCItem->nick = xstrdup("hopm"); IRCItem->port = 6667; IRCItem->readtimeout = 900; + IRCItem->reconnectinterval = 30; IRCItem->oper = xstrdup("undefined"); IRCItem->username = xstrdup("hopm"); IRCItem->realname = xstrdup("Hybrid Open Proxy Monitor"); diff --git a/src/config.h b/src/config.h index 153e76d..31e99e0 100644 --- a/src/config.h +++ b/src/config.h @@ -41,6 +41,7 @@ struct IRCConf char *server; int port; time_t readtimeout; + time_t reconnectinterval; char *password; char *vhost; char *nickserv; diff --git a/src/irc.c b/src/irc.c index acdb6d4..478f85d 100644 --- a/src/irc.c +++ b/src/irc.c @@ -358,8 +358,8 @@ irc_reconnect(void) time(&present); - /* Only try to reconnect every RECONNECT_INTERVAL seconds */ - if ((present - IRC_LASTRECONNECT) < RECONNECTINTERVAL) + /* Only try to reconnect every IRCItem->reconnectinterval seconds */ + if ((present - IRC_LASTRECONNECT) < IRCItem->reconnectinterval) { /* Sleep to avoid excessive CPU */ sleep(1); diff --git a/src/options.h b/src/options.h index 7d11bef..db55963 100644 --- a/src/options.h +++ b/src/options.h @@ -22,7 +22,4 @@ /* Timeout of commands (in seconds) */ #define COMMANDTIMEOUT 180 - -/* Interval in how often we try to reconnect (in seconds) */ -#define RECONNECTINTERVAL 30 #endif /* OPTIONS_H */