Module: ngircd.git
Branch: master
Commit: f37e495a2badf94fff2eaff24ed730dbceef94e0
URL: http://ngircd.barton.de/cgi-bin/gitweb.cgi?p=ngircd.git&a=commit;h=f37e495a…
Author: Alexander Barton <alex(a)barton.de>
Date: Wed Dec 29 14:19:51 2010 +0100
Command throttling: introduce MAX_COMMANDS_SERVICE
New MAX_COMMANDS_SERVICE (currently set to MAX_COMMANDS_SERVER[10]),
so that services are handled like servers (and not regular users).
---
src/ngircd/conn.c | 11 ++++++++---
1 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/src/ngircd/conn.c b/src/ngircd/conn.c
index 73a66bb..51ab8fd 100644
--- a/src/ngircd/conn.c
+++ b/src/ngircd/conn.c
@@ -82,6 +82,7 @@
#define MAX_COMMANDS 3
#define MAX_COMMANDS_SERVER 10
+#define MAX_COMMANDS_SERVICE MAX_COMMANDS_SERVER
static bool Handle_Write PARAMS(( CONN_ID Idx ));
@@ -1530,7 +1531,7 @@ Read_Request( CONN_ID Idx )
/**
* Handle all data in the connection read-buffer.
* Data is processed until no complete command is left in the read buffer,
- * or MAX_COMMANDS[_SERVER] commands were processed.
+ * or MAX_COMMANDS[_SERVER|_SERVICE] commands were processed.
* When a fatal error occurs, the connection is shut down.
* @param Idx Index of the connection.
* @return number of bytes processed.
@@ -1555,8 +1556,12 @@ Handle_Buffer(CONN_ID Idx)
/* Servers do get special command limits, so they can process
* all the messages that are required while peering. */
- if (Client_Type(c) == CLIENT_SERVER)
- maxcmd = MAX_COMMANDS_SERVER;
+ switch (Client_Type(c)) {
+ case CLIENT_SERVER:
+ maxcmd = MAX_COMMANDS_SERVER; break;
+ case CLIENT_SERVICE:
+ maxcmd = MAX_COMMANDS_SERVICE; break;
+ }
starttime = time(NULL);
for (i=0; i < maxcmd; i++) {
Module: ngircd.git
Branch: master
Commit: 36d4f6c6015a0c93a2785e135d43dc8f23797b38
URL: http://ngircd.barton.de/cgi-bin/gitweb.cgi?p=ngircd.git&a=commit;h=36d4f6c6…
Author: Alexander Barton <alex(a)barton.de>
Date: Fri Dec 24 12:48:03 2010 +0100
Don't assert() when serching a client for an invalid server token
This is only relevant when a trusted server on a server-server link
sends invalid commands.
---
src/ngircd/client.c | 12 +++++++-----
1 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/src/ngircd/client.c b/src/ngircd/client.c
index 739c5ea..ecd1a7c 100644
--- a/src/ngircd/client.c
+++ b/src/ngircd/client.c
@@ -553,17 +553,19 @@ Client_Search( const char *Nick )
} /* Client_Search */
+/**
+ * Get client structure ("introducer") identfied by a server token.
+ * @return CLIENT structure or NULL if none could be found.
+ */
GLOBAL CLIENT *
Client_GetFromToken( CLIENT *Client, int Token )
{
- /* Client-Struktur, die den entsprechenden Introducer (=Client)
- * und das gegebene Token hat, liefern. Wird keine gefunden,
- * so wird NULL geliefert. */
-
CLIENT *c;
assert( Client != NULL );
- assert( Token > 0 );
+
+ if (!Token)
+ return NULL;
c = My_Clients;
while (c) {
Module: ngircd.git
Branch: master
Commit: 60bb40d67a8d7c1e38a5d8ca2b7968cf08706008
URL: http://ngircd.barton.de/cgi-bin/gitweb.cgi?p=ngircd.git&a=commit;h=60bb40d6…
Author: Alexander Barton <alex(a)barton.de>
Date: Thu Dec 2 13:38:42 2010 +0100
Reset ID of outgoing server link on DNS error correctly
Not resetting the ID prevents the daemon from trying to re-establish
outgoing server links when the DNS resolver failed to resole a hostname.
---
src/ngircd/conn.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/src/ngircd/conn.c b/src/ngircd/conn.c
index 2d5e129..a92f99f 100644
--- a/src/ngircd/conn.c
+++ b/src/ngircd/conn.c
@@ -1968,8 +1968,11 @@ cb_Connect_to_Server(int fd, UNUSED short events)
/* Read result from pipe */
len = Proc_Read(&Conf_Server[i].res_stat, dest_addrs, sizeof(dest_addrs));
- if (len == 0)
+ if (len == 0) {
+ /* Error resolving hostname: reset server structure */
+ Conf_Server[i].conn_id = NONE;
return;
+ }
assert((len % sizeof(ng_ipaddr_t)) == 0);