]> arthur.barton.de Git - ngircd-alex.git/blobdiff - src/ngircd/conf.c
Spelling fix: "nick name" -> "nickname"
[ngircd-alex.git] / src / ngircd / conf.c
index b60057070f5077bf71c2898368c98b21b795788f..da7ff844b50c14d1a17a21c9687aae9534d4a185 100644 (file)
@@ -481,8 +481,12 @@ Conf_UnsetServer( CONN_ID Idx )
                                 * require the next attempt to be delayed. */
                                Conf_Server[i].lasttry =
                                        t - Conf_ConnectRetry + RECONNECT_DELAY;
-                       } else
-                               Conf_Server[i].lasttry = t;
+                       } else {
+                               /* "Short" connection, enforce "ConnectRetry"
+                                * but randomize it a little bit: 15 seconds. */
+                               Conf_Server[i].lasttry =
+                                       t + rand() / (RAND_MAX / 15);
+                       }
                }
        }
 }
@@ -490,7 +494,7 @@ Conf_UnsetServer( CONN_ID Idx )
 /**
  * Set connection information for specified configured server.
  */
-GLOBAL void
+GLOBAL bool
 Conf_SetServer( int ConfServer, CONN_ID Idx )
 {
        assert( ConfServer > NONE );
@@ -498,13 +502,15 @@ Conf_SetServer( int ConfServer, CONN_ID Idx )
 
        if (Conf_Server[ConfServer].conn_id > NONE &&
            Conf_Server[ConfServer].conn_id != Idx) {
-               Log(LOG_ALERT,
-                       "Trying to update connection index for already registered server \"%s\": %d/%d - ignored.",
-                       Conf_Server[ConfServer].name,
-                       Conf_Server[ConfServer].conn_id, Idx);
-               return;
+               Log(LOG_ERR,
+                   "Connection %d: Server configuration of \"%s\" already in use by connection %d!",
+                   Idx, Conf_Server[ConfServer].name,
+                   Conf_Server[ConfServer].conn_id);
+               Conn_Close(Idx, NULL, "Server configuration already in use", true);
+               return false;
        }
        Conf_Server[ConfServer].conn_id = Idx;
+       return true;
 }
 
 /**
@@ -638,11 +644,11 @@ Conf_AddServer(const char *Name, UINT16 Port, const char *Host,
 }
 
 /**
- * Check if the given nick name is reserved for services on a particular server.
+ * Check if the given nickname is reserved for services on a particular server.
  *
  * @param ConfServer The server index to check.
- * @param Nick The nick name to check.
- * @returns true if the given nick name belongs to an "IRC service".
+ * @param Nick The nickname to check.
+ * @returns true if the given nickname belongs to an "IRC service".
  */
 GLOBAL bool
 Conf_NickIsService(int ConfServer, const char *Nick)
@@ -655,11 +661,11 @@ Conf_NickIsService(int ConfServer, const char *Nick)
 }
 
 /**
- * Check if the given nick name is blocked for "normal client" use.
+ * Check if the given nickname is blocked for "normal client" use.
  *
  * @param ConfServer The server index or NONE to check all configured servers.
- * @param Nick The nick name to check.
- * @returns true if the given nick name belongs to an "IRC service".
+ * @param Nick The nickname to check.
+ * @returns true if the given nickname belongs to an "IRC service".
  */
 GLOBAL bool
 Conf_NickIsBlocked(const char *Nick)
@@ -1068,7 +1074,7 @@ Check_ArgIsTrue(const char *Arg)
  *
  * @param Line Line number in configuration file.
  * @raram Arg  Input string.
- * @returns    New configured maximum nick name length.
+ * @returns    New configured maximum nickname length.
  */
 static unsigned int
 Handle_MaxNickLength(int Line, const char *Arg)