Module: ngircd.git
Branch: master
Commit: cc06e1ff89ae4b7ffc8d95a8ab1d9b6787a5d142
URL: http://ngircd.barton.de/cgi-bin/gitweb.cgi?p=ngircd.git&a=commit;h=cc06e1ff…
Author: Alexander Barton <alex(a)barton.de>
Date: Fri Jan 6 02:26:04 2012 +0100
Proc_Close(): Only close socket if it is still valid
It could be invalid when calling Proc_Close() a 2nd time, for exmaple,
which could happen when we hit a timeout doing IDENT requests :-(
---
src/ngircd/proc.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/src/ngircd/proc.c b/src/ngircd/proc.c
index 7addb47..e062cd0 100644
--- a/src/ngircd/proc.c
+++ b/src/ngircd/proc.c
@@ -154,7 +154,10 @@ Proc_Read(PROC_STAT *proc, void *buffer, size_t buflen)
GLOBAL void
Proc_Close(PROC_STAT *proc)
{
- io_close(proc->pipe_fd);
+ /* Close socket, if it exists */
+ if (proc->pipe_fd >= 0)
+ io_close(proc->pipe_fd);
+
Proc_InitStruct(proc);
}
Module: ngircd.git
Branch: master
Commit: e0f8ce093ad2cc389fe8ffd404addaf609451b3f
URL: http://ngircd.barton.de/cgi-bin/gitweb.cgi?p=ngircd.git&a=commit;h=e0f8ce09…
Author: Alexander Barton <alex(a)barton.de>
Date: Wed Jan 4 23:30:55 2012 +0100
README: update features list, borrow from list on our website
---
README | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/README b/README
index f9b3662..1ea96ef 100644
--- a/README
+++ b/README
@@ -44,12 +44,14 @@ WHOIS, WHOWAS.
III. Features (or: why use ngIRCd?)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- no problems with servers which have dynamic IP addresses
-- simple, easy understandable configuration file,
-- freely published open-source C source code,
-- ngIRCd will be developed on in the future.
+- well arranged (lean) configuration file
+- simple to build/install, configure and maintain
+- supports IPv6 and SSL
+- no problems with servers that have dynamic IP addresses
+- freely available, modern, portable and tidy C-source
- wide field of supported platforms, including AIX, A/UX, FreeBSD, HP-UX,
IRIX, Linux, Mac OS X, NetBSD, OpenBSD, Solaris, and Windows with Cygwin.
+- ngIRCd is being actively developed since 2001.
IV. Documentation
Module: ngircd.git
Branch: master
Commit: b24d645ca183194b0158cd7bba1e0c1f468a7de9
URL: http://ngircd.barton.de/cgi-bin/gitweb.cgi?p=ngircd.git&a=commit;h=b24d645c…
Author: Alexander Barton <alex(a)barton.de>
Date: Wed Jan 4 21:39:46 2012 +0100
Conn_SetPenalty(): Add new "penalty time" on each function call
Until now, the penalty time has only been set when longer as the
already set one, so it didn't accumulate.
And add documentation for and clean up code in Conn_SetPenalty() and
Conn_ResetPenalty() functions.
---
src/ngircd/conn-func.c | 51 +++++++++++++++++++++++++++++++++--------------
1 files changed, 36 insertions(+), 15 deletions(-)
diff --git a/src/ngircd/conn-func.c b/src/ngircd/conn-func.c
index 8b0b6f7..32001f0 100644
--- a/src/ngircd/conn-func.c
+++ b/src/ngircd/conn-func.c
@@ -65,35 +65,56 @@ Conn_LastPing( CONN_ID Idx )
} /* Conn_LastPing */
+/**
+ * Add "penalty time" for a connection.
+ *
+ * During the "penalty time" the socket is ignored completely, no new data
+ * is read. This function only increases the penalty, it is not possible to
+ * decrease the penalty time.
+ *
+ * @param Idex Connection index.
+ * @param Seconds Seconds to add.
+ * @see Conn_ResetPenalty
+ */
GLOBAL void
-Conn_SetPenalty( CONN_ID Idx, time_t Seconds )
+Conn_SetPenalty(CONN_ID Idx, time_t Seconds)
{
- /* set Penalty-Delay for a socket.
- * during the penalty, the socket is ignored completely, no new
- * data is read. This function only increases the penalty, it is
- * not possible to decrease the penalty time.
- */
time_t t;
-
- assert( Idx > NONE );
- assert( Seconds >= 0 );
- t = time( NULL ) + Seconds;
- if (t > My_Connections[Idx].delaytime)
+ assert(Idx > NONE);
+ assert(Seconds >= 0);
+
+ t = time(NULL);
+ if (My_Connections[Idx].delaytime < t)
My_Connections[Idx].delaytime = t;
+ My_Connections[Idx].delaytime += Seconds;
+
#ifdef DEBUG
- Log(LOG_DEBUG, "Add penalty time on connection %d: %ld second(s).",
- Idx, (long)Seconds);
+ Log(LOG_DEBUG,
+ "Add penalty time on connection %d: %ld second%s, total %ld second%s.",
+ Idx, (long)Seconds, Seconds != 1 ? "s" : "",
+ My_Connections[Idx].delaytime - t,
+ My_Connections[Idx].delaytime - t != 1 ? "s" : "");
#endif
} /* Conn_SetPenalty */
+/**
+ * Reset the "penalty time" for one connection.
+ *
+ * @param Idx Connection index.
+ * @see Conn_SetPenalty
+ */
GLOBAL void
-Conn_ResetPenalty( CONN_ID Idx )
+Conn_ResetPenalty(CONN_ID Idx)
{
- assert( Idx > NONE );
+ assert(Idx > NONE);
+
My_Connections[Idx].delaytime = 0;
+#ifdef DEBUG
+ Log(LOG_DEBUG, "Penalty time on connection %d has been reset.");
+#endif
} /* Conn_ResetPenalty */