+2006-12-31 Michael Poole <mdpoole@troilus.org>
+
+ * ircd/m_mode.c (ms_mode): Bounce modes from deopped members.
+
+2006-12-30 Michael Poole <mdpoole@troilus.org>
+
+ * 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 <mdpoole@troilus.org>
+
+ * 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 <mdpoole@troilus.org>
* ircd/m_burst.c (ms_burst): Properly handle member mode :ov.
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 */
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.
* --
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;
while (s < endp && (*s++ = *s2++))
;
+ if (s == endp)
+ *s = '\0';
return s1;
}
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 */
}
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)
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;
}
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;
}
assert(0 != cptr);
assert(cptr == sptr);
- ClrFlag(cptr, FLAG_PINGSENT);
+ ClearPingSent(cptr);
cli_lasttime(cptr) = CurrentTime;
return 0;
}
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;
}
}
* 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,
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: