- Made the RECONNECTINTERVAL configurable via the hopm.conf
authormichael <michael@82007160-df01-0410-b94d-b575c5fd34c7>
Tue, 9 Jun 2015 18:22:56 +0000 (18:22 +0000)
committermichael <michael@82007160-df01-0410-b94d-b575c5fd34c7>
Tue, 9 Jun 2015 18:22:56 +0000 (18:22 +0000)
git-svn-id: svn://svn.ircd-hybrid.org/svnroot/hopm/branches/1.0.x@6079 82007160-df01-0410-b94d-b575c5fd34c7

doc/reference.conf
src/config-lexer.l
src/config-parser.y
src/config.c
src/config.h
src/irc.c
src/options.h

index 8dd072862d465a78ed3eeea2037b59e12fe6d7ca..a2b2967542a152370afd4cff37415b7a806529da 100644 (file)
@@ -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
index 97cb36871fd4d08f620def57b0e41a13e1e1569d..c98748d95e819d4ae84e81d01f1519356f029033 100644 (file)
@@ -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;      }
index 907766f3bfaebffaf9abacabb4e6a465ee9841fe..858d83cd679a9d8fa87df7b377bb883bd69a5238 100644 (file)
@@ -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);
index 1998f0050e9416829652f2ebe917460d550aa677..7009763cc9f67fc53985f62b6a3115280f1a9cf0 100644 (file)
@@ -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");
index 153e76de4937ff07fa84b9e652a9a38bfffc6e03..31e99e04c0344d40147080336440f2e5074c8cfc 100644 (file)
@@ -41,6 +41,7 @@ struct IRCConf
   char *server;
   int port;
   time_t readtimeout;
+  time_t reconnectinterval;
   char *password;
   char *vhost;
   char *nickserv;
index acdb6d4728414a79d073a611f7033b283524acef..478f85d797b0e5e3870f896f9b4578f070adf556 100644 (file)
--- 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);
index 7d11bef36e595548acf4c1d23683251cdc869a19..db55963611e42d104000f2b3b14cd9e1cc0bcbe6 100644 (file)
@@ -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 */