struct Conn {
ISNODE(Conn);
int fd, max_queue, stream, quitting;
- ArticleList queue; /* not yet told peer, or CHECK said send it */
+ ArticleList waiting; /* not yet told peer */
+ ArticleList priority; /* peer says send it now */
ArticleList sent; /* offered/transmitted - in xmit or waiting reply */
struct iovec xmit[CONNIOVS];
XmitDetails xmitd[CONNIOVS];
* connections, the spare ones will go away eventually.
*/
for (walk=LIST_HEAD(conns); walk; walk=LIST_NEXT(walk)) {
- int inqueue= walk->sent.count + walk->queue.count;
+ int inqueue= walk->sent.count + walk->priority.count
+ + walk->waiting.count;
spare= walk->max_queue - inqueue;
assert(inqueue <= max_queue_per_conn);
assert(spare >= 0);
if (use) {
while (spare>0) {
Article *art= LIST_REMHEAD(queue);
- LIST_ADDTAIL(use->queue, art);
+ LIST_ADDTAIL(use->waiting, art);
spare--;
}
conn_maybe_write(use);
int requeue[art_MaxState];
Article *art;
- while ((art= LIST_REMHEAD(conn->queue))) LIST_ADDTAIL(queue, art);
+ while ((art= LIST_REMHEAD(conn->priority))) LIST_ADDTAIL(queue, art);
+ while ((art= LIST_REMHEAD(conn->waiting))) LIST_ADDTAIL(queue, art);
while ((art= LIST_REMHEAD(conn->sent))) {
requeue[art->state]++;
if (art->state==art_Unsolicited) art->state= art_Unchecked;
if (conn->xmitu+5 > CONNIOVS)
break;
- Article *art= LIST_REMHEAD(queue);
+ Article *art= LIST_REMHEAD(priority);
+ if (!art) art= LIST_REMHEAD(waiting);
if (!art) break;
if (art->state >= art_Wanted || (conn->stream && nocheck)) {
connfail(conn, "peer gave unexpected response to QUIT: %s", sani);
} else {
notice("#%d idle connection closed\n");
- assert(!conn->queue.count);
+ assert(!conn->waiting.count);
+ assert(!conn->priority.count);
assert(!conn->sent.count);
assert(!conn->xmitu);
LIST_REMOVE(conns,conn);
assert(art->state == art_Unchecked);
art->ipf->counts[art->state][RC_accepted]++;
art->state= art_Wanted;
- LIST_ADDTAIL(conn->queue, art);
+ LIST_ADDTAIL(conn->priority, art);
break;
case 431: /* CHECK or TAKETHIS says try later */