X-Git-Url: http://git.pk910.de/?a=blobdiff_plain;f=ircd%2Fmsgq.c;h=379ffae6a873261e63620d17e8b1a81ff8048e80;hb=refs%2Fheads%2Fupstream-ssl;hp=e4692e7712fd8bd8c22cdb8c5c4e5870e6b2703a;hpb=4aa43cc32f7bf3d6e69df7481a33fd0c2c775267;p=ircu2.10.12-pk.git diff --git a/ircd/msgq.c b/ircd/msgq.c index e4692e7..379ffae 100644 --- a/ircd/msgq.c +++ b/ircd/msgq.c @@ -15,8 +15,10 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id$ + */ +/** @file + * @brief Outbound message queue implementation. + * @version $Id$ */ #include "config.h" @@ -25,6 +27,7 @@ #include "ircd_alloc.h" #include "ircd_defs.h" #include "ircd_features.h" +#include "ircd_log.h" #include "ircd_reply.h" #include "ircd_snprintf.h" #include "numeric.h" @@ -32,7 +35,7 @@ #include "s_debug.h" #include "s_stats.h" -#include +/* #include -- Now using assert in ircd_log.h */ #include #include #include @@ -255,7 +258,7 @@ msgq_alloc(struct MsgBuf *in_mb, int length) struct MsgBuf *mb; int power; - /* Find the power of two size that will accomodate the message */ + /* Find the power of two size that will accommodate the message */ for (power = MB_BASE_SHIFT; power < MB_MAX_SHIFT + 1; power++) if ((length - 1) >> power == 0) break; @@ -356,10 +359,12 @@ msgq_vmake(struct Client *dest, const char *format, va_list vl) } if (!mb) { /* OK, try killing a client */ kill_highest_sendq(0); /* Don't kill any server connections */ + msgq_clear_freembs(); /* Release whatever was just freelisted */ mb = msgq_alloc(0, BUFSIZE); } if (!mb) { /* hmmm... */ kill_highest_sendq(1); /* Try killing a server connection now */ + msgq_clear_freembs(); /* Clear freelist again */ mb = msgq_alloc(0, BUFSIZE); } if (!mb) /* AIEEEE! */ @@ -561,9 +566,10 @@ msgq_count_memory(struct Client *cptr, size_t *msg_alloc, size_t *msgbuf_alloc) /* Data for Msg's is simple, so just send it */ send_reply(cptr, SND_EXPLICIT | RPL_STATSDEBUG, - ":Msgs allocated %d(%zu) used %d(%zu)", MQData.msgs.alloc, - MQData.msgs.alloc * sizeof(struct Msg), MQData.msgs.used, - MQData.msgs.used * sizeof(struct Msg)); + ":Msgs allocated %d(%zu) used %d(%zu) text %zu", + MQData.msgs.alloc, MQData.msgs.alloc * sizeof(struct Msg), + MQData.msgs.used, MQData.msgs.used * sizeof(struct Msg), + MQData.tot_bufsize); /* count_memory() wants to know the total */ *msg_alloc = MQData.msgs.alloc * sizeof(struct Msg); @@ -611,8 +617,8 @@ msgq_histogram(struct Client *cptr, const struct StatDesc *sd, char *param) send_reply(cptr, SND_EXPLICIT | RPL_STATSDEBUG, ":Histogram of message lengths (%lu messages)", tmp.msgs); for (i = 0; i + 16 <= BUFSIZE; i += 16) - send_reply(cptr, SND_EXPLICIT | RPL_STATSDEBUG, ":% 4d: %lu %lu %lu %lu " - "%lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu", i + 1, + send_reply(cptr, SND_EXPLICIT | RPL_STATSDEBUG, ":% 4d: %u %u %u %u " + "%u %u %u %u %u %u %u %u %u %u %u %u", i + 1, tmp.sizes[i + 0], tmp.sizes[i + 1], tmp.sizes[i + 2], tmp.sizes[i + 3], tmp.sizes[i + 4], tmp.sizes[i + 5], tmp.sizes[i + 6], tmp.sizes[i + 7], tmp.sizes[i + 8],