Committer  : entrope
CVSROOT    : /cvsroot/undernet-ircu
Module     : ircu2.10
Commit time: 2006-08-03 03:32:56 UTC

Modified files:
     ircd/msgq.c include/msgq.h ChangeLog

Log message:

Move "sent" field from struct Msg to struct MsgQList.

---------------------- diff included ----------------------
Index: ircu2.10/ChangeLog
diff -u ircu2.10/ChangeLog:1.817 ircu2.10/ChangeLog:1.818
--- ircu2.10/ChangeLog:1.817    Wed Aug  2 20:13:31 2006
+++ ircu2.10/ChangeLog  Wed Aug  2 20:32:46 2006
@@ -1,5 +1,15 @@
 2006-08-02  Michael Poole <[EMAIL PROTECTED]>
 
+       * include/msgq.h (MsgQList): Add 'sent' field.
+
+       * ircd/msgq.c (Msg): Remove 'sent' field.
+       (msgq_delmsg): Update for new position of 'sent'.
+       (msgq_delete): Likewise.
+       (msgq_mapiov): Likewise.
+       (msgq_add): msg->sent went away; do not set it.
+
+2006-08-02  Michael Poole <[EMAIL PROTECTED]>
+
        * ircd/ircd_parser.y (connectblock): Check for too-long password.
        (operblock): Comment why we don't check password length.  Move
        PRIV_PROPAGATE test earlier (so a buggy edit, rehash, /oper will
Index: ircu2.10/include/msgq.h
diff -u ircu2.10/include/msgq.h:1.8 ircu2.10/include/msgq.h:1.9
--- ircu2.10/include/msgq.h:1.8 Mon Oct  4 21:21:37 2004
+++ ircu2.10/include/msgq.h     Wed Aug  2 20:32:46 2006
@@ -20,7 +20,7 @@
  */
 /** @file
  * @brief Outbound message queue interface and declarations.
- * @version $Id: msgq.h,v 1.8 2004/10/05 04:21:37 entrope Exp $
+ * @version $Id: msgq.h,v 1.9 2006/08/03 03:32:46 entrope Exp $
  */
 #ifndef INCLUDED_ircd_defs_h
 #include "ircd_defs.h" /* BUFSIZE */
@@ -46,6 +46,7 @@
 struct MsgQList {
   struct Msg *head;            /**< First Msg in queue list */
   struct Msg *tail;            /**< Last Msg in queue list */
+  unsigned int sent;           /**< Bytes in *head that have already been sent 
*/
 };
 
 /** Entire two-priority message queue for a destination. */
Index: ircu2.10/ircd/msgq.c
diff -u ircu2.10/ircd/msgq.c:1.14 ircu2.10/ircd/msgq.c:1.15
--- ircu2.10/ircd/msgq.c:1.14   Fri Jul 14 17:09:10 2006
+++ ircu2.10/ircd/msgq.c        Wed Aug  2 20:32:46 2006
@@ -18,7 +18,7 @@
  */
 /** @file
  * @brief Outbound message queue implementation.
- * @version $Id: msgq.c,v 1.14 2006/07/15 00:09:10 entrope Exp $
+ * @version $Id: msgq.c,v 1.15 2006/08/03 03:32:46 entrope Exp $
  */
 #include "config.h"
 
@@ -61,7 +61,6 @@
 /** Message body for a particular destination. */
 struct Msg {
   struct Msg *next;            /**< next msg */
-  unsigned int sent;           /**< bytes in msg that have already been sent */
   struct MsgBuf *msg;          /**< actual message in queue */
 };
 
@@ -111,7 +110,7 @@
 
   m = qlist->head; /* find the msg we're deleting from */
 
-  msglen = m->msg->length - m->sent; /* calculate how much is left */
+  msglen = m->msg->length - qlist->sent; /* calculate how much is left */
 
   if (*length_p >= msglen) { /* deleted it all? */
     mq->length -= msglen; /* decrement length */
@@ -121,6 +120,7 @@
     msgq_clean(m->msg); /* free up the struct MsgBuf */
     m->msg = 0; /* don't let it point anywhere nasty, please */
 
+    qlist->sent = 0; /* haven't sent any of the next message */
     if (qlist->head == qlist->tail) /* figure out if we emptied the queue */
       qlist->head = qlist->tail = 0;
     else
@@ -132,7 +132,7 @@
     MQData.msgs.free = m;
   } else {
     mq->length -= *length_p; /* decrement queue length */
-    m->sent += *length_p; /* this much of the message has been sent */
+    qlist->sent += *length_p; /* this much of the message has been sent */
     *length_p = 0; /* we've dealt with it all */
   }
 }
@@ -163,7 +163,7 @@
   assert(0 != mq);
 
   while (length > 0) {
-    if (mq->queue.head && mq->queue.head->sent > 0) /* partial msg on norm q */
+    if (mq->queue.sent > 0) /* partial msg on norm q */
       msgq_delmsg(mq, &mq->queue, &length);
     else if (mq->prio.head) /* message (partial or complete) on prio queue */
       msgq_delmsg(mq, &mq->prio, &length);
@@ -197,9 +197,9 @@
   if (mq->length <= 0) /* no data to map */
     return 0;
 
-  if (mq->queue.head && mq->queue.head->sent > 0) { /* partial msg on norm q */
-    iov[i].iov_base = mq->queue.head->msg->msg + mq->queue.head->sent;
-    iov[i].iov_len = mq->queue.head->msg->length - mq->queue.head->sent;
+  if (mq->queue.sent > 0) { /* partial msg on norm q */
+    iov[i].iov_base = mq->queue.head->msg->msg + mq->queue.sent;
+    iov[i].iov_len = mq->queue.head->msg->length - mq->queue.sent;
     *len += iov[i].iov_len;
 
     queue = mq->queue.head->next; /* where we start later... */
@@ -210,9 +210,9 @@
   } else
     queue = mq->queue.head; /* start at head of queue */
 
-  if (mq->prio.head && mq->prio.head->sent > 0) { /* partial msg on prio q */
-    iov[i].iov_base = mq->prio.head->msg->msg + mq->prio.head->sent;
-    iov[i].iov_len = mq->prio.head->msg->length - mq->prio.head->sent;
+  if (mq->prio.sent > 0) { /* partial msg on prio q */
+    iov[i].iov_base = mq->prio.head->msg->msg + mq->prio.sent;
+    iov[i].iov_len = mq->prio.head->msg->length - mq->prio.sent;
     *len += iov[i].iov_len;
 
     prio = mq->prio.head->next; /* where we start later... */
@@ -502,7 +502,6 @@
   MQData.msgs.used++; /* we're using another */
 
   msg->next = 0; /* initialize the msg */
-  msg->sent = 0;
 
   /* Get the real buffer, allocating one if necessary */
   if (!mb->real) {
----------------------- End of diff -----------------------
_______________________________________________
Patches mailing list
[email protected]
http://undernet.sbg.org/mailman/listinfo/patches

Reply via email to