Committer : entrope
CVSROOT : /cvsroot/undernet-ircu
Module : ircu2.10
Branch tags: u2_10_12_branch
Commit time: 2007-01-15 03:08:33 UTC
Modified files:
Tag: u2_10_12_branch
ChangeLog include/struct.h ircd/ircd.c ircd/ircd_string.c
ircd/m_mode.c ircd/m_pong.c ircd/os_generic.c ircd/s_bsd.c
Log message:
Merge end-of-December changes from HEAD to u2_10_12_branch.
---------------------- diff included ----------------------
Index: ircu2.10/ChangeLog
diff -u ircu2.10/ChangeLog:1.710.2.134 ircu2.10/ChangeLog:1.710.2.135
--- ircu2.10/ChangeLog:1.710.2.134 Sat Jan 13 10:47:16 2007
+++ ircu2.10/ChangeLog Sun Jan 14 19:08:22 2007
@@ -1,3 +1,28 @@
+2006-12-31 Michael Poole <[EMAIL PROTECTED]>
+
+ * ircd/m_mode.c (ms_mode): Bounce modes from deopped members.
+
+2006-12-30 Michael Poole <[EMAIL PROTECTED]>
+
+ * ircd/ircd_string.c (ircd_strncpy): Make sure the output buffer
+ is terminated. We don't rely on the arguable strncpy semantics.
+
+2006-12-30 Michael Poole <[EMAIL PROTECTED]>
+
+ * include/struct.h (struct Server): Add asll_last field.
+
+ * ircd/ircd.c (check_pings): Add check for asll_last. When a
+ server doesn't ping, use an old-style ping rather than AsLL ping.
+
+ * ircd/m_pong.c (ms_pong): Use ClearPingSent() rather than
+ ClrFlag(). Set asll_last to current time.
+ (mr_pong): Use ClearPingSent() rather than ClrFlag().
+ (m_pong): Likewise.
+
+ * ircd/s_bsd.c (completed_connection): Likewise.
+ (read_packet): Likewise. Update cli_lasttime for servers in
+ addition to clients.
+
2006-01-13 Michael Poole <[EMAIL PROTECTED]>
* ircd/m_burst.c (ms_burst): Properly handle member mode :ov.
Index: ircu2.10/include/struct.h
diff -u ircu2.10/include/struct.h:1.9 ircu2.10/include/struct.h:1.9.2.1
--- ircu2.10/include/struct.h:1.9 Wed Mar 30 20:05:55 2005
+++ ircu2.10/include/struct.h Sun Jan 14 19:08:23 2007
@@ -20,7 +20,7 @@
*/
/** @file
* @brief Structure definitions for users and servers.
- * @version $Id: struct.h,v 1.9 2005/03/31 04:05:55 entrope Exp $
+ * @version $Id: struct.h,v 1.9.2.1 2007/01/15 03:08:23 entrope Exp $
*/
#ifndef INCLUDED_struct_h
#define INCLUDED_struct_h
@@ -57,6 +57,7 @@
int asll_rtt; /**< AsLL round-trip time */
int asll_to; /**< AsLL upstream lag */
int asll_from; /**< AsLL downstream lag */
+ time_t asll_last; /**< Last time we sent or received an AsLL
ping */
char *last_error_msg; /**< Allocated memory with last message
receive with an ERROR */
char by[NICKLEN + 1]; /**< Numnick of client who requested the link
*/
Index: ircu2.10/ircd/ircd.c
diff -u ircu2.10/ircd/ircd.c:1.91.2.3 ircu2.10/ircd/ircd.c:1.91.2.4
--- ircu2.10/ircd/ircd.c:1.91.2.3 Sun May 7 18:55:08 2006
+++ ircu2.10/ircd/ircd.c Sun Jan 14 19:08:23 2007
@@ -19,7 +19,7 @@
*/
/** @file
* @brief Entry point and other initialization functions for the daemon.
- * @version $Id: ircd.c,v 1.91.2.3 2006/05/08 01:55:08 entrope Exp $
+ * @version $Id: ircd.c,v 1.91.2.4 2007/01/15 03:08:23 entrope Exp $
*/
#include "config.h"
@@ -356,6 +356,24 @@
IsPingSent(cptr) ? "[Ping Sent]" : "[]",
max_ping, (int)(CurrentTime - cli_lasttime(cptr))));
+ /* If it's a server and we have not sent an AsLL lately, do so. */
+ if (IsServer(cptr)) {
+ if (CurrentTime - cli_serv(cptr)->asll_last >= max_ping) {
+ char *asll_ts;
+
+ SetPingSent(cptr);
+ cli_serv(cptr)->asll_last = CurrentTime;
+ expire = cli_serv(cptr)->asll_last + max_ping;
+ asll_ts = militime_float(NULL);
+ sendcmdto_prio_one(&me, CMD_PING, cptr, "!%s %s %s", asll_ts,
+ cli_name(cptr), asll_ts);
+ }
+
+ expire = cli_serv(cptr)->asll_last + max_ping;
+ if (expire < next_check)
+ next_check = expire;
+ }
+
/* Ok, the thing that will happen most frequently, is that someone will
* have sent something recently. Cover this first for speed.
* --
@@ -418,11 +436,7 @@
if (IsUser(cptr))
sendrawto_one(cptr, MSG_PING " :%s", cli_name(&me));
else
- {
- char *asll_ts = militime_float(NULL);
- sendcmdto_one(&me, CMD_PING, cptr, "!%s %s %s", asll_ts,
- cli_name(cptr), asll_ts);
- }
+ sendcmdto_prio_one(&me, CMD_PING, cptr, ":%s", cli_name(&me));
}
expire = cli_lasttime(cptr) + max_ping * 2;
Index: ircu2.10/ircd/ircd_string.c
diff -u ircu2.10/ircd/ircd_string.c:1.24 ircu2.10/ircd/ircd_string.c:1.24.2.1
--- ircu2.10/ircd/ircd_string.c:1.24 Mon Sep 12 09:11:58 2005
+++ ircu2.10/ircd/ircd_string.c Sun Jan 14 19:08:23 2007
@@ -18,7 +18,7 @@
*/
/** @file
* @brief Implementation of string operations.
- * @version $Id: ircd_string.c,v 1.24 2005/09/12 16:11:58 entrope Exp $
+ * @version $Id: ircd_string.c,v 1.24.2.1 2007/01/15 03:08:23 entrope Exp $
*/
#include "config.h"
@@ -156,6 +156,8 @@
while (s < endp && (*s++ = *s2++))
;
+ if (s == endp)
+ *s = '\0';
return s1;
}
Index: ircu2.10/ircd/m_mode.c
diff -u ircu2.10/ircd/m_mode.c:1.15.2.3 ircu2.10/ircd/m_mode.c:1.15.2.4
--- ircu2.10/ircd/m_mode.c:1.15.2.3 Sat Mar 18 07:52:58 2006
+++ ircu2.10/ircd/m_mode.c Sun Jan 14 19:08:23 2007
@@ -20,7 +20,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
- * $Id: m_mode.c,v 1.15.2.3 2006/03/18 15:52:58 entrope Exp $
+ * $Id: m_mode.c,v 1.15.2.4 2007/01/15 03:08:23 entrope Exp $
*/
/*
@@ -197,7 +197,7 @@
MODE_PARSE_FORCE), /* And force it to be accepted */
NULL);
} else {
- if (!(member = find_member_link(chptr, sptr))) {
+ if (!(member = find_member_link(chptr, sptr)) || !IsChanOp(member)) {
modebuf_init(&mbuf, sptr, cptr, chptr,
(MODEBUF_DEST_SERVER | /* Send mode to server */
MODEBUF_DEST_HACK2 | /* Send a HACK(2) message */
Index: ircu2.10/ircd/m_pong.c
diff -u ircu2.10/ircd/m_pong.c:1.16.2.5 ircu2.10/ircd/m_pong.c:1.16.2.6
--- ircu2.10/ircd/m_pong.c:1.16.2.5 Sat May 13 19:46:58 2006
+++ ircu2.10/ircd/m_pong.c Sun Jan 14 19:08:23 2007
@@ -20,7 +20,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
- * $Id: m_pong.c,v 1.16.2.5 2006/05/14 02:46:58 entrope Exp $
+ * $Id: m_pong.c,v 1.16.2.6 2007/01/15 03:08:23 entrope Exp $
*/
/*
@@ -119,8 +119,8 @@
}
origin = parv[1];
destination = parv[2];
- ClrFlag(cptr, FLAG_PINGSENT);
- ClrFlag(sptr, FLAG_PINGSENT);
+ ClearPingSent(cptr);
+ ClearPingSent(sptr);
cli_lasttime(cptr) = CurrentTime;
if (parc > 5)
@@ -129,6 +129,7 @@
cli_serv(cptr)->asll_rtt = atoi(militime_float(parv[3]));
cli_serv(cptr)->asll_to = atoi(parv[4]);
cli_serv(cptr)->asll_from = atoi(militime_float(parv[5]));
+ cli_serv(cptr)->asll_last = CurrentTime;
return 0;
}
@@ -162,7 +163,7 @@
assert(cptr == sptr);
assert(!IsRegistered(sptr));
- ClrFlag(cptr, FLAG_PINGSENT);
+ ClearPingSent(cptr);
return (parc > 1) ? auth_set_pong(cli_auth(sptr), strtoul(parv[parc - 1],
NULL, 10)) : 0;
}
@@ -178,7 +179,7 @@
assert(0 != cptr);
assert(cptr == sptr);
- ClrFlag(cptr, FLAG_PINGSENT);
+ ClearPingSent(cptr);
cli_lasttime(cptr) = CurrentTime;
return 0;
}
Index: ircu2.10/ircd/os_generic.c
diff -u ircu2.10/ircd/os_generic.c:1.23.2.5 ircu2.10/ircd/os_generic.c:1.23.2.6
--- ircu2.10/ircd/os_generic.c:1.23.2.5 Wed Dec 6 21:14:51 2006
+++ ircu2.10/ircd/os_generic.c Sun Jan 14 19:08:23 2007
@@ -18,7 +18,7 @@
*/
/** @file
* @brief Implementation of OS-dependent operations.
- * @version $Id: os_generic.c,v 1.23.2.5 2006/12/07 05:14:51 entrope Exp $
+ * @version $Id: os_generic.c,v 1.23.2.6 2007/01/15 03:08:23 entrope Exp $
*/
#include "config.h"
@@ -450,9 +450,13 @@
if (0 < (res = recv(fd, buf, length, 0))) {
*count_out = (unsigned) res;
return IO_SUCCESS;
+ } else if (res == 0) {
+ *count_out = 0;
+ errno = 0; /* or ECONNRESET? */
+ return IO_FAILURE;
} else {
*count_out = 0;
- return (res < 0) && is_blocked(errno) ? IO_BLOCKED : IO_FAILURE;
+ return is_blocked(errno) ? IO_BLOCKED : IO_FAILURE;
}
}
Index: ircu2.10/ircd/s_bsd.c
diff -u ircu2.10/ircd/s_bsd.c:1.80.2.2 ircu2.10/ircd/s_bsd.c:1.80.2.3
--- ircu2.10/ircd/s_bsd.c:1.80.2.2 Wed Dec 6 19:35:31 2006
+++ ircu2.10/ircd/s_bsd.c Sun Jan 14 19:08:23 2007
@@ -19,7 +19,7 @@
*/
/** @file
* @brief Functions that now (or in the past) relied on BSD APIs.
- * @version $Id: s_bsd.c,v 1.80.2.2 2006/12/07 03:35:31 entrope Exp $
+ * @version $Id: s_bsd.c,v 1.80.2.3 2007/01/15 03:08:23 entrope Exp $
*/
#include "config.h"
@@ -352,7 +352,7 @@
* Make us timeout after twice the timeout for DNS look ups
*/
cli_lasttime(cptr) = CurrentTime;
- SetFlag(cptr, FLAG_PINGSENT);
+ ClearPingSent(cptr);
sendrawto_one(cptr, MSG_SERVER " %s 1 %Tu %Tu J%s %s%s +%s6 :%s",
cli_name(&me), cli_serv(&me)->timestamp, newts,
@@ -581,12 +581,11 @@
case IO_SUCCESS:
if (length)
{
- if (!IsServer(cptr))
- cli_lasttime(cptr) = CurrentTime;
+ cli_lasttime(cptr) = CurrentTime;
+ ClearPingSent(cptr);
+ ClrFlag(cptr, FLAG_NONL);
if (cli_lasttime(cptr) > cli_since(cptr))
cli_since(cptr) = cli_lasttime(cptr);
- ClrFlag(cptr, FLAG_PINGSENT);
- ClrFlag(cptr, FLAG_NONL);
}
break;
case IO_BLOCKED:
----------------------- End of diff -----------------------
_______________________________________________
Patches mailing list
[email protected]
http://undernet.sbg.org/mailman/listinfo/patches